/* Corporate white redesign layer. Existing IDs stay intact for the legacy JS. */

html,
body {
  min-width: 0;
}

body {
  margin: 0;
  padding: 0 24px 40px;
  font-size: 14px;
  line-height: 1.45;
  overflow-x: auto;
}

body.birthday-ticker-on {
  padding-top: 36px;
}

body.ui-overlay-open {
  overflow: hidden;
}

.container {
  width: min(100%, 1800px);
  max-width: 1800px !important;
  margin: 0 auto;
}

.app-shell-header {
  position: sticky;
  top: 0;
  z-index: 80;
  width: calc(100% + 48px);
  margin: 0 0 0 -24px;
  padding: 0 24px;
  border-bottom: 1px solid var(--ui-border);
  background: rgba(255, 255, 255, 0.97);
  box-shadow: var(--ui-shadow-xs);
  backdrop-filter: blur(12px);
}

body.birthday-ticker-on .app-shell-header {
  top: 36px;
}

.app-shell-header .shell-inner {
  width: min(100%, 1800px);
  min-height: 64px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: auto minmax(500px, 1fr) auto;
  align-items: center;
  gap: 24px;
}

.shell-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: max-content;
}

.shell-brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: var(--ui-radius-md);
  background: var(--ui-primary);
  color: #fff;
  font-size: 13px;
  font-weight: 750;
  letter-spacing: 0.02em;
  box-shadow: 0 4px 12px rgba(31, 95, 174, 0.22);
}

.shell-brand-copy {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.shell-brand-copy strong {
  color: var(--ui-text);
  font-size: 14px;
  font-weight: 700;
}

.shell-brand-copy span {
  margin-top: 3px;
  color: var(--ui-text-muted);
  font-size: 12px;
}

.workspace-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.workspace-nav .nav-home,
.workspace-nav summary {
  min-height: 36px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid transparent;
  border-radius: var(--ui-radius-sm);
  background: transparent;
  color: var(--ui-text-secondary);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  list-style: none;
  white-space: nowrap;
}

.workspace-nav .nav-home {
  background: var(--ui-primary-soft);
  color: var(--ui-primary);
}

.workspace-nav summary::-webkit-details-marker {
  display: none;
}

.workspace-nav summary::after {
  content: "";
  width: 6px;
  height: 6px;
  margin-top: -3px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg);
}

.workspace-nav details {
  position: relative;
}

.workspace-nav details[open] summary,
.workspace-nav summary:hover {
  border-color: var(--ui-border);
  background: var(--ui-surface-subtle);
  color: var(--ui-text);
}

.nav-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: var(--ui-z-menu);
  min-width: 260px;
  padding: 6px;
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius-md);
  background: var(--ui-surface);
  box-shadow: var(--ui-shadow-md);
}

.nav-menu .btn-filters,
.nav-menu .btn-birthdays,
.nav-menu .btn-meet,
.nav-menu a.btn-filters {
  width: 100%;
  min-height: 38px;
  margin: 0;
  padding: 8px 10px;
  justify-content: flex-start;
  border: 0;
  border-radius: var(--ui-radius-sm);
  background: transparent;
  color: var(--ui-text-secondary);
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  text-decoration: none;
  white-space: normal;
}

.nav-menu .btn-filters:hover,
.nav-menu .btn-birthdays:hover,
.nav-menu .btn-meet:hover,
.nav-menu a.btn-filters:hover {
  background: var(--ui-primary-soft);
  color: var(--ui-primary);
}

.nav-menu .btn-meet .meet-inner,
.nav-menu .btn-meet .meet-person {
  display: inline;
}

.nav-menu .btn-meet .meet-prefix::after {
  content: ": ";
}

.nav-menu .meet-crown {
  display: none;
}

.nav-menu .btn-birthdays.active {
  display: flex;
}

.shell-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: max-content;
}

.shell-period {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-right: 10px;
  border-right: 1px solid var(--ui-border);
}

.shell-controls .month-select {
  height: 34px;
  padding: 0 28px 0 9px;
  border: 1px solid var(--ui-border-strong);
  border-radius: var(--ui-radius-sm);
  background-color: var(--ui-surface);
  color: var(--ui-text-secondary);
  font-size: 12px;
}

.shell-controls .filesearch-btn {
  width: 34px;
  height: 34px;
  border-color: var(--ui-border);
  border-radius: var(--ui-radius-sm);
  background: var(--ui-surface);
}

.shell-controls .filesearch-btn:hover {
  border-color: var(--ui-border-strong);
  background: var(--ui-surface-subtle);
}

.shell-user {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
}

.shell-user .btn-fill,
.shell-user .btn-logout {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 34px;
  min-height: 34px;
  margin: 0;
  padding: 0 12px;
  border: 1px solid var(--ui-primary);
  border-radius: var(--ui-radius-sm);
  font-size: 12px;
  font-weight: 650;
}

.shell-user .btn-fill {
  background: var(--ui-primary);
}

.shell-user .btn-fill:hover {
  background: var(--ui-primary-hover);
}

.shell-user .btn-logout {
  border-color: var(--ui-border);
  background: var(--ui-surface);
  color: var(--ui-text-secondary);
}

.shell-user .btn-logout:hover {
  background: var(--ui-surface-subtle);
}

.shell-user .auth-status {
  max-width: 130px;
  margin: 0;
  overflow: hidden;
  color: var(--ui-text-muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shell-user .auth-status.logged-in {
  color: var(--ui-success);
}

.shell-connection {
  display: flex;
  align-items: center;
}

.shell-connection .conn-status {
  width: 28px;
  height: 28px;
  margin: 0;
  justify-content: center;
  border-radius: 50%;
  background: var(--ui-surface-subtle);
}

.shell-connection .conn-label,
.shell-controls .current-date {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin: 0;
  padding: 28px 0 18px;
}

.page-heading .page-title {
  margin: 0;
  color: var(--ui-text);
  font-size: clamp(24px, 2vw, 30px);
  font-weight: 720;
  letter-spacing: -0.025em;
  text-align: left;
}

.page-heading-copy {
  max-width: 780px;
}

.page-eyebrow {
  margin-bottom: 5px;
  color: var(--ui-primary);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.page-description {
  margin-top: 5px;
  color: var(--ui-text-muted);
  font-size: 13px;
}

.page-heading-period {
  display: none;
}

.grid {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.summary-row,
.metrics-section,
.test-section,
.table-card {
  width: 100%;
}

.summary-row {
  order: 1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.summary-row .info-box {
  min-height: 92px;
  align-items: flex-start;
  padding: 16px 18px;
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius-lg);
  background: var(--ui-surface);
  box-shadow: var(--ui-shadow-xs);
}

.summary-row .info-box-label {
  margin-bottom: 8px;
  color: var(--ui-text-muted);
  font-size: 12px;
  font-weight: 600;
}

.summary-row .info-box-value {
  color: var(--ui-text);
  font-size: clamp(20px, 2vw, 26px);
  font-weight: 720;
  letter-spacing: -0.02em;
}

.summary-row .info-box-1 {
  cursor: pointer;
}

.summary-row .info-box-1:hover {
  border-color: #a9c7eb;
  box-shadow: 0 0 0 3px var(--ui-primary-soft);
}

.table-card {
  order: 3;
  max-height: min(62vh, 720px);
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius-lg);
  background: var(--ui-surface);
  box-shadow: var(--ui-shadow-xs);
  overflow: visible;
}

.table-filters-bar {
  min-height: 58px;
  padding: 10px 18px;
  gap: 8px;
  border-bottom-color: var(--ui-border);
}

.btn-filters,
.tab-btn,
.btn-mini,
.btn-apply,
.btn-clear,
.btn-submit {
  border-radius: var(--ui-radius-sm);
}

.table-filters-bar .btn-filters,
.table-bottom-bar .btn-filters,
.table-filters-bar .btn-mini,
.table-bottom-bar .btn-mini {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--ui-border-strong);
  background: var(--ui-surface);
  color: var(--ui-text-secondary);
  font-size: 12px;
  font-weight: 600;
}

.table-filters-bar .btn-filters:hover,
.table-bottom-bar .btn-filters:hover {
  border-color: #a9c7eb;
  background: var(--ui-primary-soft);
  color: var(--ui-primary);
}

.table-filters-bar #filtersBtn,
.contract-kind-bar #filtersBtn,
.table-filters-bar #projectFiltersBtn {
  border-color: var(--ui-primary);
  background: var(--ui-primary);
  color: #fff;
}

.table-filters-bar #filtersBtn:hover,
.contract-kind-bar #filtersBtn:hover,
.table-filters-bar #projectFiltersBtn:hover {
  background: var(--ui-primary-hover);
}

#projectModal .project-filters-bar {
  margin: 12px 0 10px;
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius-md);
}

.table-filters-bar .risk-right {
  margin-left: auto;
}

.filters-count,
.risk-count,
.changes-count,
.birthday-count {
  border-radius: 999px;
}

.filters-popup,
.export-menu,
.filesearch-pop {
  border-color: var(--ui-border);
  border-radius: var(--ui-radius-md);
  box-shadow: var(--ui-shadow-md);
}

.filters-popup label {
  color: var(--ui-text-secondary);
  font-weight: 600;
}

.filters-popup input,
.filters-popup select,
#filterExecutor summary,
.filesearch-input {
  min-height: 36px;
  border-color: var(--ui-border-strong);
  border-radius: var(--ui-radius-sm);
}

#filterExecutor { position: relative; width: 100%; }
#filterExecutor summary { position: relative; box-sizing: border-box; padding-right: 28px; cursor: pointer; list-style: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#filterExecutor summary::-webkit-details-marker { display: none; }
#filterExecutor summary::after { content: ''; position: absolute; right: 10px; top: 50%; width: 6px; height: 6px; border-right: 1px solid var(--ui-text-secondary); border-bottom: 1px solid var(--ui-text-secondary); transform: translateY(-70%) rotate(45deg); }
#filterExecutor .exec-pick-list { display: none; position: absolute; z-index: 60; width: 100%; box-sizing: border-box; margin: 2px 0 0; padding: 2px 0; border: 1px solid var(--ui-border); border-radius: var(--ui-radius-sm); background: var(--ui-surface); box-shadow: var(--ui-shadow-md); }
#filterExecutor[open] .exec-pick-list { display: flex; }
#filterExecutor .exec-pick-item { display: flex; margin: 0; padding: 6px 8px; border-radius: 0; font-weight: 400; }
#filterExecutor .exec-pick-item:hover { background: var(--ui-primary-soft); }
#filterExecutor input[type="checkbox"] { min-height: 0 !important; width: auto; }

.filters-popup .month-range-input {
  min-height: 0;
  border: 0;
  border-radius: 0;
}

.table-scroll {
  scrollbar-color: #b9c3d0 #f5f7fa;
  scrollbar-width: thin;
}

.table-scroll table {
  color: var(--ui-text);
}

#incomeTableWrap > table,
#expenseTableWrap > table {
  min-width: 1120px;
}

.table-scroll thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  padding: 10px 9px;
  border-bottom: 1px solid var(--ui-border-strong);
  background: #f1f4f8;
  color: #3d4a5c;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.015em;
}

.table-scroll th.sortable:hover {
  background: #e8eef5;
}

.page-table-header {
  position: fixed;
  z-index: 5;
  overflow: hidden;
  background: #f1f4f8;
}

@media print {
  .page-table-header { display: none; }
}

.table-scroll tbody td {
  border-bottom-color: #e9edf2;
  color: var(--ui-text-secondary);
}

.table-scroll tbody tr:hover > td {
  box-shadow: inset 0 0 0 999px rgba(31, 95, 174, 0.035);
}

.table-card tr.st-project td {
  background: #f4f5f7;
}

.table-card tr.st-work td {
  background: var(--ui-primary-soft);
}

.table-card tr.st-done td {
  background: #edf8f1;
}

.table-bottom-bar {
  min-height: 48px;
  padding: 7px 12px 7px 18px;
  border-top: 1px solid var(--ui-border);
  background: var(--ui-surface);
}

.contract-kind-bar {
  position: relative;
  margin-top: 0;
  border-top: 0;
  border-bottom: 1px solid var(--ui-border);
}

.contract-kind-actions .export-menu {
  left: auto;
  right: 0;
}

.contract-kind-actions .filters-popup {
  left: auto;
  right: 16px;
}

.table-tabs {
  gap: 4px;
}

.table-tabs .tab-btn {
  min-height: 34px;
  padding: 0 12px;
  border: 0;
  background: transparent;
  color: var(--ui-text-muted);
  font-size: 12px;
  font-weight: 600;
}

.table-tabs .tab-btn.on {
  background: var(--ui-primary-soft);
  color: var(--ui-primary);
}

.closed-year-tabs {
  padding-left: 10px;
  border-left: 1px solid var(--ui-border);
}

.closed-year-tabs[hidden] {
  display: none;
}

.closed-year-count {
  font-weight: 400;
  opacity: 0.7;
}

#projectModal .modal,
#projectWorkModal .modal {
  overflow: hidden;
}

.modal-table-card {
  width: 100%;
  height: min(68vh, 720px);
  max-height: none;
  margin-top: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  overflow: visible;
}

.modal-table-card > .table-scroll,
.project-work-card > .pw-panel,
.project-work-card > .pw-panel > .table-scroll {
  flex: 1 1 auto;
  min-height: 0;
}

.project-work-card > .pw-panel {
  overflow: hidden;
}

.project-work-card > .pw-panel > .table-scroll {
  height: 100%;
}

.modal-table-card .table-bottom-bar {
  flex: 0 0 auto;
}

.modal-table-card > .table-bottom-bar {
  margin-top: 0;
  padding: 0 0 7px;
  border-top: 0;
  border-bottom: 1px solid var(--ui-border);
}

.date-duration-popover {
  position: fixed;
  z-index: var(--ui-z-popover);
  width: min(290px, calc(100vw - 16px));
  padding: 14px;
  border: 1px solid var(--ui-border-strong);
  border-radius: var(--ui-radius-md);
  background: var(--ui-surface);
  box-shadow: var(--ui-shadow-md);
}

.date-duration-popover[hidden] {
  display: none;
}

.date-duration-popover form,
.date-duration-popover label {
  display: grid;
  gap: 5px;
}

.date-duration-popover form {
  gap: 10px;
}
.date-duration-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.date-duration-popover label.date-duration-work {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
}
.date-duration-popover label.date-duration-work input {
  width: 12px;
  height: 12px;
  min-width: 0;
  margin: 0;
  padding: 0;
}


.date-duration-popover label {
  color: var(--ui-text-secondary);
  font-size: 12px;
}

.date-duration-popover input {
  width: 100%;
  min-height: var(--ui-control-height);
  padding: 6px 8px;
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius-sm);
  background: var(--ui-surface);
  color: var(--ui-text);
}

.date-duration-popover input[readonly] {
  background: var(--ui-surface-subtle);
}

.date-duration-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

#projectModal .project-filters-bar {
  margin: 0;
  border: 0;
  border-bottom: 1px solid var(--ui-border);
  border-radius: 0;
}

.project-work-table .pw-zayavka-inp,
.project-work-table .pwr-text,
.project-work-table .pwr-date {
  border-color: transparent;
  background: transparent;
}

.project-work-table .pw-zayavka-inp:hover,
.project-work-table .pwr-text:hover,
.project-work-table .pwr-date:hover {
  border-color: var(--ui-border-strong);
  background: var(--ui-surface-subtle);
}

.request-executors {
  display: flex;
  align-items: center;
  gap: 4px;
}

.request-executors .cell-edit {
  min-width: 110px;
}

.request-name {
  width: 100%;
  min-height: 28px;
  resize: none;
  overflow: hidden;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.35;
  text-align: left;
}

.test-section {
  order: 4;
  padding: 16px;
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius-lg);
  background: var(--ui-surface);
  box-shadow: var(--ui-shadow-xs);
}

.test-section h2 {
  margin-bottom: 14px;
  color: var(--ui-text);
  font-size: 17px;
  text-align: left;
  text-transform: none;
}

.forecast-card {
  display: grid;
  align-items: stretch;
  justify-content: normal;
  gap: 0;
  padding: 0;
  border: 0;
  background: transparent;
}

.metrics-section {
  order: 2;
  scroll-margin-top: 18px;
}

.gauges-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.gauges-row::before {
  content: none;
}

.metrics-section .section-title {
  margin: 6px 0 10px;
  color: var(--ui-text);
  font-size: 17px;
  font-weight: 700;
}

.forecast-visuals {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  gap: 16px;
  width: 100%;
  min-width: 0;
}

.forecast-chart-panel {
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius-md);
  background: var(--ui-surface);
}

.forecast-chart-panel h2 {
  margin: 0;
  color: var(--ui-text-secondary);
  font-size: 13px;
  font-weight: 700;
}

.forecast-chart-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 14px;
}

.forecast-legend {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  color: var(--ui-text-muted);
  font-size: 12px;
}

.forecast-legend span::before {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 5px;
  border-radius: 2px;
  content: "";
}

.forecast-legend .plan::before { background: #b8c7d9; }
.forecast-legend .fact::before { background: var(--ui-primary); }
.forecast-legend .year::before { background: var(--ui-success); }

.forecast-legend .curve::before {
  width: 16px;
  height: 3px;
  border-radius: 999px;
  background: #7446a8;
  vertical-align: middle;
}

.forecast-perf-btn {
  min-height: 24px;
  padding: 2px 10px;
  border: 1px solid var(--ui-border-strong);
  border-radius: 999px;
  background: var(--ui-surface);
  color: var(--ui-primary);
  font: inherit;
  cursor: pointer;
}

.forecast-perf-btn:hover,
.forecast-perf-btn:focus-visible { background: var(--ui-primary-soft); }

.forecast-bars {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: stretch;
  height: 320px;
  padding: 30px 8px 0;
  border-bottom: 1px solid var(--ui-border-strong);
}

.forecast-bars.has-year-battery {
  grid-template-columns: minmax(0, 1fr) 8px minmax(300px, .6fr);
  gap: 2px;
}

.forecast-history {
  position: relative;
  display: grid;
  grid-template-columns: repeat(var(--history-months), minmax(24px, 1fr));
  align-items: end;
  gap: 6px;
  min-width: 0;
  height: 100%;
  margin-left: 44px;
}

.forecast-axis {
  position: absolute;
  inset: 0 0 20px;
  pointer-events: none;
}

.forecast-axis-tick {
  position: absolute;
  right: 0;
  left: 0;
  border-top: 1px solid var(--ui-border);
}

.forecast-axis-tick > span {
  position: absolute;
  right: calc(100% + 6px);
  transform: translateY(-50%);
  color: var(--ui-text-muted);
  font-size: 12px;
  line-height: 1;
  white-space: nowrap;
}

.forecast-year-divider {
  position: relative;
  height: 100%;
}

.forecast-year-divider::before {
  position: absolute;
  top: 0;
  bottom: 20px;
  left: calc(50% + 10px);
  width: 2px;
  transform: translateX(-50%);
  border-radius: 2px;
  background: var(--ui-border-strong);
  content: "";
}

.forecast-bar-group {
  display: grid;
  grid-template-rows: 1fr 20px;
  align-self: stretch;
  min-width: 0;
}

.forecast-bar-stack {
  position: relative;
  min-height: 0;
}

.forecast-bar-deviation {
  position: absolute;
  left: 50%;
  z-index: 4;
  max-width: calc(100% + 20px);
  transform: translateX(-50%);
  color: var(--ui-text-muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  pointer-events: none;
}

.forecast-bar-deviation.positive { color: var(--ui-success); }
.forecast-bar-deviation.negative { color: var(--ui-danger); }

.forecast-bar {
  position: absolute;
  bottom: 0;
  left: 50%;
  display: block;
  min-height: 0;
  transform: translateX(-50%);
  border-radius: 3px 3px 0 0;
  transition: height 300ms ease;
}

.forecast-bar.plan {
  width: calc(100% - 8px);
  border: 1px solid #9fb2c8;
  background: rgba(184, 199, 217, .58);
}

.forecast-bar.plan.no-plan {
  border-color: transparent;
  background: transparent;
}

.forecast-bar.fact {
  z-index: 1;
  width: 62%;
  background: var(--ui-primary);
}

.forecast-bar.fact.on-plan { background: var(--ui-success); }

.forecast-bar-value {
  position: absolute;
  top: 4px;
  left: 50%;
  z-index: 2;
  max-width: calc(100% - 4px);
  overflow: hidden;
  transform: translateX(-50%);
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
  pointer-events: none;
}

.forecast-bar-plan-value {
  color: var(--ui-text-secondary);
}

.forecast-bar-fact-value {
  color: #fff;
}

.forecast-bar-cmpe-fact-value {
  top: auto;
  bottom: 4px;
  color: #5f4800;
  text-shadow: none;
}

.forecast-bar-plan-value.is-obscured,
.forecast-bar-value.is-clipped {
  visibility: hidden;
}

.forecast-bar-group.is-cmpe-january .forecast-bar.plan {
  border-color: #c99b00;
  background: rgba(255, 215, 64, .42);
}

.forecast-bar-cmpe {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 2;
  transform: translate(-50%, -50%);
  color: #5f4800;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: .02em;
  white-space: nowrap;
  pointer-events: none;
}

.forecast-bar-label {
  align-self: end;
  overflow: hidden;
  color: var(--ui-text-muted);
  font-size: 12px;
  text-align: center;
  text-overflow: clip;
}

.forecast-year-battery {
  display: grid;
  grid-template-rows: minmax(0, 1fr) 20px;
  align-self: stretch;
  min-width: 0;
  height: 100%;
  gap: 4px;
  padding: 0 6px;
}

.forecast-battery-shell {
  position: relative;
  align-self: center;
  width: min(calc(100% - 22px), max(70%, 250px));
  height: 108px;
  min-height: 0;
  max-height: none;
  margin: 0 auto;
  overflow: visible;
  border: 3px solid #718197;
  border-radius: 16px 12px 12px 16px;
  background: rgba(184, 199, 217, .28);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .8);
  cursor: help;
}

.forecast-battery-shell::before {
  position: absolute;
  top: 50%;
  right: -10px;
  width: 7px;
  height: 34px;
  transform: translateY(-50%);
  border: 3px solid #718197;
  border-left: 0;
  border-radius: 0 5px 5px 0;
  background: var(--ui-surface);
  content: "";
}

.forecast-battery-fill {
  position: absolute;
  top: 2px;
  bottom: 2px;
  left: 2px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  max-width: calc(100% - 4px);
  overflow: hidden;
  padding: 3px;
  border-radius: 11px 2px 2px 11px;
  background: var(--ui-success);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .45);
  transition: width 300ms ease;
}

.forecast-battery-percent {
  position: absolute;
  top: -34px;
  left: 50%;
  z-index: 3;
  padding: 3px 8px;
  transform: translateX(-50%);
  border-radius: 999px;
  background: rgba(255, 255, 255, .9);
  color: var(--ui-text-secondary);
  font-size: 24px;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}

.forecast-battery-remaining {
  position: absolute;
  top: 2px;
  right: 2px;
  bottom: 2px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  max-width: calc(100% - 4px);
  overflow: hidden;
  padding: 3px;
  color: var(--ui-text-secondary);
}

.forecast-battery-fill strong,
.forecast-battery-remaining strong {
  max-width: 100%;
  overflow: hidden;
  font-size: 16px;
  font-weight: 800;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.forecast-battery-fill strong {
  color: #fff;
  text-shadow: 0 1px 1px rgba(0, 0, 0, .28);
}

.forecast-battery-shell.fact-outside .forecast-battery-fill,
.forecast-battery-shell.remaining-outside .forecast-battery-remaining {
  overflow: visible;
}

.forecast-battery-shell.fact-outside .forecast-battery-fill strong,
.forecast-battery-shell.remaining-outside .forecast-battery-remaining strong {
  position: absolute;
  top: 50%;
  z-index: 5;
  width: max-content;
  max-width: none;
  padding: 5px 8px;
  transform: translateY(-50%);
  border: 1px solid var(--ui-border-strong);
  border-radius: 7px;
  background: rgba(255, 255, 255, .96);
  box-shadow: 0 4px 12px rgba(15, 23, 42, .14);
  text-shadow: none;
}

.forecast-battery-shell.fact-outside .forecast-battery-fill strong {
  right: calc(100% + 14px);
  color: var(--ui-success);
}

.forecast-battery-shell.remaining-outside .forecast-battery-remaining strong {
  left: calc(100% + 14px);
  color: var(--ui-text-secondary);
}

.forecast-year-battery .forecast-bar-label {
  line-height: 20px;
  white-space: nowrap;
}

.forecast-line-layer {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 20px;
  left: 0;
  z-index: 3;
  width: 100%;
  height: calc(100% - 20px);
  overflow: visible;
  pointer-events: none;
}

.forecast-line-path {
  fill: none;
  stroke: #7446a8;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 4;
  vector-effect: non-scaling-stroke;
  filter: drop-shadow(0 1px 2px rgba(61, 38, 88, .2));
  pointer-events: none;
}

.forecast-line-hit {
  fill: none;
  stroke: transparent;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 14;
  vector-effect: non-scaling-stroke;
  pointer-events: stroke;
  cursor: help;
}

.forecast-bar-tooltip {
  position: absolute;
  z-index: 6;
  width: max-content;
  max-width: min(260px, calc(100% - 16px));
  padding: 8px 10px;
  pointer-events: none;
  border: 1px solid rgba(15, 23, 42, .16);
  border-radius: 7px;
  background: rgba(20, 29, 43, .96);
  box-shadow: 0 8px 22px rgba(15, 23, 42, .2);
  color: #fff;
  font-size: 12px;
  line-height: 1.35;
  opacity: 0;
  transform: translate(-50%, calc(-100% + 6px)) scale(.97);
  visibility: hidden;
  transition: opacity 110ms ease, transform 110ms ease, visibility 0s linear 110ms;
}

.forecast-bar-tooltip.active {
  opacity: 1;
  transform: translate(-50%, -100%) scale(1);
  visibility: visible;
  transition-delay: 0s;
}

.forecast-bar-tooltip.below {
  transform: translate(-50%, -6px) scale(.97);
}

.forecast-bar-tooltip.below.active {
  transform: translate(-50%, 0) scale(1);
}

.stage-project-files-btn,
#tableBody .stage-toggle,
#tableBody .request-stage-toggle,
#executorCardModal .gauge-stage-toggle,
#executorCardModal .request-stage-toggle {
  flex: 0 0 auto;
  display: inline-grid;
  width: 24px;
  height: 24px;
  padding: 0;
  place-items: center;
  border: 1px solid var(--ui-primary);
  border-radius: var(--ui-radius-sm);
  background: var(--ui-primary-soft);
  color: var(--ui-primary);
  font-size: 16px;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
}

.stage-project-files-btn:hover,
#tableBody .stage-toggle:hover,
#tableBody .request-stage-toggle:hover,
#executorCardModal .gauge-stage-toggle:hover,
#executorCardModal .request-stage-toggle:hover {
  background: var(--ui-primary);
  color: #fff;
}

#tableBody .stage-toggle,
#tableBody .request-stage-toggle,
#executorCardModal .gauge-stage-toggle,
#executorCardModal .request-stage-toggle {
  width: auto;
  min-width: 24px;
  padding: 0 6px;
  font-size: 12px;
  font-weight: 400;
  font-style: normal;
  white-space: nowrap;
}

#tableBody .request-stage-toggle { margin-left: 6px; }

.stage-row .stage-project-cell {
  text-align: center;
}

.closing-debt {
  margin: 0 0 14px;
  padding: 12px 14px;
  border: 1px solid #f2ceca;
  border-radius: var(--ui-radius-md);
  background: #fff7f6;
  text-align: left;
}

.meet-nav {
  display: flex;
  align-items: center;
  gap: var(--ui-space-2);
  margin-bottom: var(--ui-space-4);
}

#meetModal .meet-nav {
  display: grid;
  justify-content: center;
}

.meet-nav-controls {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 44px;
  align-items: center;
  gap: var(--ui-space-2);
}

.meet-navbtn,
.meet-back {
  min-height: 44px;
  padding: 0 var(--ui-space-3);
  border: 1px solid var(--ui-border-strong);
  border-radius: var(--ui-radius-sm);
  background: var(--ui-surface);
  color: var(--ui-text);
  font-weight: 600;
  cursor: pointer;
}

.meet-navbtn:hover:not(:disabled),
.meet-back:hover { border-color: var(--ui-primary); }
.meet-navbtn:disabled { opacity: .55; cursor: default; }
.meet-navbtn { min-width: 44px; font-size: 22px; }
#meetModal .meet-navbtn { padding: 0; }
.meet-month { min-width: 145px; text-align: center; font-size: 16px; font-weight: 700; }
.meet-month::first-letter { text-transform: uppercase; }

.meet-calendars {
  --meet-weekend: color-mix(in srgb, var(--ui-danger-soft) 75%, var(--ui-surface));
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  grid-auto-rows: 1fr;
}

.meet-calendar-panel {
  min-width: 0;
  padding: var(--ui-space-4);
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius-md);
  background: var(--ui-surface-subtle);
}

#meetDetails:not([hidden]) {
  display: flex;
  flex-direction: column;
  contain: size;
  min-height: 0;
}

#meetDetails > :not(.meet-time-scroll) { flex: none; }

.meet-calendar-panel h3 {
  margin: 0 0 var(--ui-space-3);
  font-size: 18px;
}

#meetLitTitle, #meetShvTitle { text-align: center; }

.meet-status {
  margin: var(--ui-space-3) 0 0;
  color: var(--ui-text-secondary);
  font-size: 13px;
}

.meet-weekdays,
.meet-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: var(--ui-space-1);
}

.meet-weekdays { margin-bottom: var(--ui-space-1); text-align: center; color: var(--ui-text-secondary); font-size: 12px; }
.meet-day {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  min-height: 80px;
  padding: var(--ui-space-1);
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius-sm);
  background: var(--ui-surface);
  color: var(--ui-text);
  text-align: start;
}
.meet-day.has-meet { background: var(--ui-primary-soft); cursor: pointer; }
.meet-weekdays > :nth-last-child(-n + 2) { color: var(--ui-danger); }
.meet-grid > .meet-day:is(:nth-child(7n + 6), :nth-child(7n)),
.meet-time-cell.is-weekend { background-color: var(--meet-weekend); }
button.meet-day:hover, .meet-day[aria-expanded="true"] { border-color: var(--ui-primary); }
.meet-day[aria-expanded="true"] { box-shadow: inset 0 0 0 1px var(--ui-primary); }
.meet-day:focus-visible { outline-offset: -3px; }
.meet-day-heading { display: flex; align-items: center; justify-content: space-between; gap: 2px; width: 100%; font-size: 13px; }
.meet-day[aria-current="date"] .meet-day-heading > b { color: var(--ui-primary-hover); text-decoration: underline; text-underline-offset: 3px; }
.meet-count {
  padding: 0 4px;
  border-radius: var(--ui-radius-sm);
  background: var(--ui-surface);
  color: var(--ui-primary-hover);
  font-size: 11px;
  font-weight: 700;
}

.meet-preview {
  display: flex;
  align-items: baseline;
  gap: 3px;
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  overflow: hidden;
  padding: 1px 3px;
  border-radius: 3px;
  background: var(--ui-primary-soft);
  font-size: 11px;
  line-height: 14px;
}
.meet-preview b { flex: none; color: var(--ui-primary-hover); }
.meet-preview > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.meet-agenda-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--ui-space-2);
  margin-bottom: var(--ui-space-3);
}

.meet-agenda-heading > h3 { margin: 0; overflow-wrap: anywhere; }
.meet-range-modes {
  display: flex;
  flex-wrap: wrap;
  gap: var(--ui-space-1);
  margin-bottom: var(--ui-space-3);
}
.meet-range-modes > .tab-btn { min-height: 44px; padding-inline: var(--ui-space-3); }
.meet-range-modes > [aria-pressed="true"] {
  border-color: var(--ui-primary);
  background: var(--ui-primary-soft);
  color: var(--ui-primary-hover);
  font-weight: 700;
}

.meet-time-scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius-md);
  background: var(--ui-surface);
}

.meet-time-table {
  --meet-axis-width: 52px;
  --meet-day-width: 120px;
  display: grid;
  grid-template-columns: var(--meet-axis-width) repeat(var(--meet-days), minmax(var(--meet-day-width), 1fr));
  min-width: calc(var(--meet-axis-width) + var(--meet-days) * var(--meet-day-width));
  padding-bottom: var(--ui-space-2);
}

.meet-time-axis {
  position: sticky;
  left: 0;
  z-index: 1;
  box-sizing: border-box;
  border-right: 1px solid var(--ui-border);
  background: var(--ui-surface-subtle);
  color: var(--ui-text-secondary);
  font-size: 11px;
  text-align: center;
}

.meet-time-zone,
.meet-time-date {
  display: grid;
  align-content: center;
  min-height: 40px;
  padding: var(--ui-space-1);
  font-size: 13px;
  text-align: center;
  border-bottom: 1px solid var(--ui-border);
}
.meet-time-date.is-anchor {
  background: var(--ui-primary-soft);
  color: var(--ui-primary-hover);
  font-weight: 700;
}
.meet-time-cell { min-width: 0; border-inline-end: 1px solid var(--ui-border); }
.meet-time-category { padding: var(--ui-space-2) 2px; overflow-wrap: anywhere; }
.meet-time-date.is-weekend.is-anchor {
  background: var(--meet-weekend);
  box-shadow: inset 0 -2px var(--ui-primary);
}
.meet-time-extra {
  display: grid;
  align-content: start;
  gap: var(--ui-space-1);
  padding: var(--ui-space-1);
  border-bottom: 1px solid var(--ui-border);
}

.meet-time-scale,
.meet-time-day {
  height: calc(var(--meet-hours) * var(--meet-hour));
  box-shadow: inset 0 -1px var(--ui-border);
}
.meet-time-scale > span {
  position: absolute;
  inset-inline: 0;
  padding-block: 2px;
  background: var(--ui-surface-subtle);
  transform: translateY(-50%);
  font-variant-numeric: tabular-nums;
}
.meet-time-scale > span:first-child { transform: none; }
.meet-time-scale > span:last-child { transform: translateY(-100%); }
.meet-time-day {
  position: relative;
  background-image: repeating-linear-gradient(to bottom,
    var(--ui-border) 0 1px, transparent 1px calc(var(--meet-hour) / 2),
    var(--ui-surface-subtle) calc(var(--meet-hour) / 2) calc(var(--meet-hour) / 2 + 1px),
    transparent calc(var(--meet-hour) / 2 + 1px) var(--meet-hour));
}

.meet-event {
  display: flex;
  align-items: baseline;
  gap: 4px;
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  min-height: 24px;
  padding: 2px 4px;
  border: 1px solid var(--ui-border-strong);
  border-radius: var(--ui-radius-sm);
  background: var(--ui-primary-soft);
  color: var(--ui-text);
  text-align: start;
  font-size: 12px;
  line-height: 16px;
}
.meet-time-scroll:focus-visible { outline-offset: -2px; }
.meet-event-timed {
  position: absolute;
  top: var(--meet-top);
  left: calc(var(--meet-left) + 1px);
  width: max(0px, calc(var(--meet-width) - 2px));
  height: var(--meet-height);
  overflow: hidden;
}
.meet-event-point { border-style: dashed; }
.meet-event-tall { flex-direction: column; align-items: stretch; gap: 0; }
.meet-event-time, .meet-event-topic { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meet-event-time { flex-shrink: 0; max-width: 50%; color: var(--ui-primary-hover); font-weight: 700; }
.meet-event-tall .meet-event-time { max-width: none; }

.meet-empty-note { margin: var(--ui-space-2) 0 0; }

.gauges-row .card {
  --gauge-accent: var(--ui-primary);
  --gauge-glow: rgba(31, 95, 174, 0.16);
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius-lg);
  box-shadow: var(--ui-shadow-xs);
  transition:
    background-color 180ms ease,
    border-color 180ms ease,
    box-shadow 180ms ease;
}

.gauges-row .year-gauge-2 {
  --gauge-accent: #2faa55;
  --gauge-glow: rgba(47, 170, 85, 0.16);
}

.gauges-row .gauge-card-2 {
  --gauge-accent: var(--ui-primary);
  --gauge-glow: rgba(47, 111, 237, 0.16);
}

.gauges-row .gauge-card-own {
  --gauge-accent: #d9534f;
  --gauge-glow: rgba(217, 83, 79, 0.16);
}

.gauges-row .gauge-card-signed {
  --gauge-accent: var(--ui-border-strong);
  --gauge-glow: rgba(113, 129, 151, 0.14);
}

.gauges-row .card:hover {
  border-color: var(--gauge-accent);
  box-shadow:
    0 0 0 2px var(--gauge-glow),
    0 16px 32px -22px var(--gauge-accent);
}

.gauges-row .card-title {
  min-height: 36px;
  margin-bottom: 8px;
  color: var(--ui-text-secondary);
  font-size: 13px;
  text-align: left;
}

.gauges-row .gauge-wrap {
  margin-bottom: 8px;
}

.gauges-row .gauge-svg {
  width: min(100%, 240px);
  height: auto;
  overflow: visible;
  transition: filter 180ms ease;
}

/* a surface coloured halo keeps the value readable when the needle passes under it */
.gauge-svg :is(.gauge-text, .gauge-unit) {
  paint-order: stroke;
  stroke: var(--ui-surface);
  stroke-width: 6px;
  stroke-linejoin: round;
}

.gauges-row .gauge-track {
  stroke: #e6ebf0;
  transition: stroke 180ms ease;
}

.gauges-row .gauge-progress,
.gauges-row .gauge-seg,
.gauges-row .gauge-needle,
.gauges-row .gauge-hub {
  transition-property: filter, stroke-dasharray, stroke-dashoffset, transform;
  transition-duration: 180ms, 300ms, 300ms, 300ms;
  transition-timing-function: ease;
}

.gauges-row .card:hover .gauge-svg {
  filter: drop-shadow(0 7px 9px rgba(15, 23, 42, 0.12));
}

.gauges-row .card:hover .gauge-track {
  stroke: #d7e2ee;
}

.gauges-row .card:hover .gauge-progress,
.gauges-row .card:hover .gauge-seg,
.gauges-row .card:hover .gauge-needle,
.gauges-row .card:hover .gauge-hub {
  filter: drop-shadow(0 0 5px var(--gauge-accent));
}

.gauges-row .gauge-card-signed:hover .gauge-needle,
.gauges-row .gauge-card-signed:hover .gauge-hub {
  filter: none;
}

.gauges-row .gauge-card-signed:hover .seg-ntr { filter: drop-shadow(0 0 5px #e08a1e); }
.gauges-row .gauge-card-signed:hover .seg-pr { filter: drop-shadow(0 0 5px var(--ui-primary)); }
.gauges-row .gauge-card-signed:hover .seg-kon { filter: drop-shadow(0 0 5px #8e44ad); }
.gauges-row .gauge-card-signed:hover .seg-ag { filter: drop-shadow(0 0 5px #16a085); }

@media (prefers-reduced-motion: reduce) {
  .gauges-row .card,
  .gauges-row .gauge-svg,
  .gauges-row .gauge-track,
  .gauges-row .gauge-progress,
  .gauges-row .gauge-seg,
  .gauges-row .gauge-needle,
  .gauges-row .gauge-hub {
    transition-duration: 0.01ms;
  }
}

.modal-overlay {
  padding: 24px;
  background: var(--ui-overlay);
  backdrop-filter: blur(2px);
}

.modal {
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius-lg);
  background: var(--ui-surface);
  box-shadow: var(--ui-shadow-md);
}

.modal h2 {
  padding-right: 48px;
  color: var(--ui-text);
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.modal-close {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: var(--ui-radius-sm);
  color: var(--ui-text-muted);
}

.modal-close:hover {
  background: var(--ui-surface-subtle);
  color: var(--ui-text);
}

.modal input,
.modal select,
.modal textarea,
.admin-panel input,
.admin-panel select,
.admin-panel textarea {
  border-color: var(--ui-border-strong);
  border-radius: var(--ui-radius-sm);
  color: var(--ui-text);
}

.modal input:focus,
.modal select:focus,
.modal textarea:focus,
.admin-panel input:focus,
.admin-panel select:focus,
.admin-panel textarea:focus {
  border-color: var(--ui-focus);
  box-shadow: 0 0 0 3px rgba(47, 116, 200, 0.14);
}

.admin-panel {
  background: var(--ui-overlay);
  backdrop-filter: blur(2px);
}

.admin-panel-inner {
  top: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  left: auto !important;
  width: min(460px, 96vw);
  max-height: none;
  padding: 64px 24px 24px;
  gap: 14px;
  border-left: 1px solid var(--ui-border);
  border-radius: 0;
  background: var(--ui-surface);
  box-shadow: var(--ui-shadow-md);
  cursor: default;
}

.admin-panel-close {
  top: 16px;
  right: 20px;
  width: 34px;
  height: 34px;
  border-radius: var(--ui-radius-sm);
}

.admin-panel-close:hover {
  background: var(--ui-surface-subtle);
}

.admin-box {
  width: 100%;
  padding: 16px;
  border-color: var(--ui-border);
  border-radius: var(--ui-radius-md);
  background: var(--ui-surface-subtle);
}

.admin-box-title {
  color: var(--ui-text);
  font-size: 14px;
}

.btn-apply,
.btn-submit {
  background: var(--ui-primary) !important;
  color: #fff !important;
}

.btn-apply {
  border: 1px solid var(--ui-primary);
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.btn-apply:hover,
.btn-submit:hover {
  background: var(--ui-primary-hover) !important;
}

.btn-apply:disabled {
  opacity: .55;
  cursor: default;
}

input[type="file"] {
  color: var(--ui-text-secondary);
  font-size: 12px;
}

input[type="file"]::file-selector-button {
  margin-right: 10px;
  padding: 6px 12px;
  border: 1px solid var(--ui-border-strong);
  border-radius: var(--ui-radius-sm);
  background: var(--ui-surface);
  color: var(--ui-text-secondary);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

input[type="file"]::file-selector-button:hover {
  border-color: #a9c7eb;
  background: var(--ui-primary-soft);
  color: var(--ui-primary);
}

.perf-chip,
.client-cat,
.exec-chip {
  border-color: var(--ui-border);
  background: var(--ui-surface-subtle);
}

.perf-chip.on,
.client-cat.on,
.exec-chip:hover {
  border-color: #a9c7eb;
  background: var(--ui-primary-soft);
  color: var(--ui-primary);
}

.exec-share-list { display: flex; flex-direction: column; gap: 2px; }
.exec-share-line { white-space: normal; overflow-wrap: anywhere; }
.exec-share-line .exec-pct { margin-left: 4px; white-space: nowrap; }

#filterExecutor summary:focus-visible,
.filters-popup .month-range-input:focus-visible,
#projectTable input:focus-visible,
#projectTable select:focus-visible,
.expense-table input.ex-edit:focus-visible,
.expense-table select.ex-edit:focus-visible,
.cell-edit:focus-visible {
  outline: 2px solid var(--ui-focus);
  outline-offset: -2px;
}

.changes-col {
  border-color: var(--ui-border);
  background: var(--ui-surface-subtle);
}

.changes-col-title {
  border-bottom-color: var(--ui-border);
  background: var(--ui-surface);
  color: var(--ui-text);
  font-size: 15px;
}

@media (max-width: 1500px) {
  body {
    padding-right: 18px;
    padding-left: 18px;
  }

  .app-shell-header {
    width: calc(100% + 36px);
    margin-left: -18px;
    padding: 0 18px;
  }

  .app-shell-header .shell-inner {
    grid-template-columns: auto 1fr auto;
    gap: 14px;
  }

  .shell-brand-copy span,
  .workspace-nav .nav-home {
    display: none;
  }

  .workspace-nav .nav-home.active {
    display: inline-flex;
  }

  .workspace-nav summary {
    padding-right: 9px;
    padding-left: 9px;
    font-size: 12px;
  }

  .shell-period #monthSelect {
    max-width: 112px;
  }

  .shell-user .auth-status {
    display: none;
  }
}

@media (max-width: 1280px) {
  .app-shell-header .shell-inner {
    grid-template-columns: auto 1fr;
    padding: 9px 0;
  }

  .shell-controls {
    grid-column: 1 / -1;
    justify-content: flex-start;
    padding-top: 8px;
    border-top: 1px solid var(--ui-border);
  }

  .shell-user {
    margin-left: auto;
  }

  .page-heading {
    padding-top: 22px;
  }

  .gauges-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1920px) {
  body {
    font-size: 15px;
  }

  .app-shell-header .shell-inner {
    min-height: 68px;
  }

  .table-card {
    max-height: min(66vh, 820px);
  }
}

@media print {
  body {
    min-width: 0;
    padding: 0;
    background: var(--ui-surface);
  }

  .app-shell-header,
  .table-filters-bar,
  .table-bottom-bar {
    display: none !important;
  }

  .container {
    max-width: none !important;
  }
}

/* Sidebar shell imported from dbsv-design2. */
:root {
  --shell-sidebar: 240px;
  --shell-sidebar-collapsed: 72px;
  --shell-blue: var(--ui-primary);
  --shell-ink: var(--ui-text);
  --shell-muted: var(--ui-text-secondary);
  --shell-border: var(--ui-border);
  --shell-bg: var(--ui-bg);
}

body {
  min-width: 0;
  padding: 0;
  background: var(--shell-bg);
}

body.shell-ready { padding-left: var(--shell-sidebar-collapsed); }
body.shell-drawer-open { overflow: hidden; }

.shell-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: var(--ui-z-sidebar);
  width: var(--shell-sidebar);
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--shell-border);
  background: var(--ui-surface);
  box-shadow: 8px 0 30px rgba(28, 48, 84, .06);
  transition: width .25s ease, transform .25s ease;
}

.shell-sidebar .shell-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  overflow: hidden;
  min-height: 82px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--shell-border);
}

.shell-sidebar .shell-brand-logo {
  display: block;
  width: 60px;
  height: 58px;
  flex: 0 0 60px;
  object-fit: contain;
  object-position: left center;
  transition: width .25s ease, flex-basis .25s ease;
}

.shell-sidebar .shell-brand-mark {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: linear-gradient(145deg, var(--ui-primary), #173f8f);
  color: #fff;
  font-size: 21px;
  font-weight: 800;
}

.shell-sidebar .shell-brand-copy {
  min-width: 0;
  overflow: hidden;
  color: var(--shell-ink);
  white-space: nowrap;
}

.shell-sidebar .shell-brand-copy strong { display: block; font-size: 14px; }
.shell-sidebar .shell-brand-copy span { display: block; margin-top: 3px; color: var(--shell-muted); font-size: 12px; }

.shell-nav {
  flex: 1;
  min-width: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 18px 12px;
}

.shell-sidebar-footer {
  flex: 0 0 auto;
  padding: 10px 12px 16px;
  border-top: 1px solid var(--shell-border);
}

.shell-sidebar-footer .shell-logout { color: #9f2f2f; }
.shell-sidebar-footer .shell-logout:hover { background: var(--ui-danger-soft); color: #842626; }

.shell-group { margin: 0 0 18px; }
.shell-group-title {
  padding: 0 12px 8px;
  color: var(--ui-text-muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.shell-nav-item {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #526176;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  text-align: left;
  text-decoration: none;
  transition: color .15s, background .15s;
}

.shell-sidebar .shell-nav-item[hidden],
.shell-sidebar .shell-group[hidden] {
  display: none !important;
}

.shell-nav-item:hover { background: #eff5ff; color: var(--shell-blue); }
.shell-nav-item.is-active { background: #eaf2ff; color: var(--shell-blue); font-weight: 700; }
.shell-nav-icon {
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.shell-nav-label {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.shell-mobile-toggle { border: 0; cursor: pointer; color: var(--shell-muted); background: var(--ui-surface-subtle); }
.shell-mobile-toggle svg {
  width: 20px;
  height: 20px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.shell-mobile-toggle { display: none; width: 38px; height: 38px; border-radius: 10px; font-size: 20px; }

.shell-scrim { position: fixed; inset: 0; z-index: var(--ui-z-scrim); display: none; background: rgba(15, 23, 42, .35); }

@media (min-width: 901px) {
  .shell-sidebar { width: var(--shell-sidebar-collapsed); }
  .shell-sidebar:hover { width: var(--shell-sidebar); }
  .shell-sidebar .shell-brand-logo {
    width: 40px;
    flex-basis: 40px;
  }
  .shell-sidebar:hover .shell-brand-logo {
    width: 60px;
    flex-basis: 60px;
  }
  .shell-sidebar .shell-brand-copy,
  .shell-sidebar .shell-nav-label {
    max-width: 0;
    opacity: 0;
    transform: translateX(-8px);
    transition: max-width .25s ease, opacity .16s ease, transform .25s ease;
  }
  .shell-sidebar .shell-group-title { visibility: hidden; }
  .shell-sidebar .shell-group-title {
    opacity: 0;
    clip-path: inset(0 100% 0 0);
    transform: translateX(-8px);
    transition: clip-path .25s ease, opacity .16s ease, transform .25s ease, visibility 0s linear .25s;
  }
  .shell-sidebar:hover .shell-brand-copy,
  .shell-sidebar:hover .shell-nav-label {
    max-width: 168px;
    opacity: 1;
    transform: translateX(0);
  }
  .shell-sidebar:hover .shell-group-title { visibility: visible; }
  .shell-sidebar:hover .shell-group-title {
    opacity: 1;
    clip-path: inset(0 0 0 0);
    transform: translateX(0);
    transition-delay: 0s;
  }

  .shell-sidebar:not(:hover) .shell-nav-item .risk-count.active,
  .shell-sidebar:not(:hover) .shell-nav-item .birthday-count.active,
  .shell-sidebar:not(:hover) .shell-nav-item .changes-count.on {
    position: absolute;
    top: 25px;
    left: 28px;
    width: 8px;
    height: 8px;
    min-width: 0;
    margin: 0;
    padding: 0;
    overflow: hidden;
    border: 2px solid #fff;
    border-radius: 50%;
    color: transparent;
    font-size: 0;
    line-height: 0;
  }
}

.container {
  width: 100%;
  max-width: none !important;
  margin: 0;
  padding: 28px clamp(20px, 3vw, 52px) 48px;
}

.dashboard-toolbar {
  position: relative;
  min-height: 56px;
  margin: 0 0 24px;
  padding: 0 0 18px;
  display: flex;
  align-items: center;
  gap: 16px;
  border-bottom: 1px solid var(--shell-border);
}

/* Pages keep only the section title from the toolbar. */
body.shell-page-active .dashboard-toolbar,
body.shell-contracts-active .dashboard-toolbar {
  min-height: 0;
  margin-bottom: 20px;
  padding-bottom: 0;
  border-bottom: 0;
}

body.shell-page-active .dashboard-toolbar > :not(.shell-mobile-toggle):not(.toolbar-context),
body.shell-contracts-active .dashboard-toolbar > :not(.shell-mobile-toggle):not(.toolbar-context),
body.shell-page-active .toolbar-context .page-eyebrow,
body.shell-contracts-active .toolbar-context .page-eyebrow {
  display: none;
}

.toolbar-context { min-width: 240px; }
.toolbar-context h1 {
  margin: 0;
  color: var(--shell-ink);
  font-size: clamp(24px, 3vw, 34px);
  font-weight: 700;
  line-height: 1.2;
}
.toolbar-context .page-eyebrow { margin: 0 0 3px; font-size: 12px; }
.toolbar-actions { flex: 1 1 0; display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 12px; }
.toolbar-actions #monthSelect,
.toolbar-actions #yearSelect[hidden],
.toolbar-actions #logoutBtn { display: none !important; }
.toolbar-actions .filesearch { flex: 0 0 auto; }
.toolbar-actions .filesearch-btn {
  width: 36px;
  height: 36px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--ui-border-strong);
  border-radius: var(--ui-radius-sm);
  background: var(--ui-surface);
  color: var(--ui-text-muted);
  font-size: 13px;
  cursor: pointer;
}
.toolbar-actions .filesearch-label,
.toolbar-actions .filesearch-kbd { display: none; }
.toolbar-actions .filesearch-btn:hover { border-color: #a9c7eb; }
.toolbar-actions .filesearch-btn:focus-visible { outline: 2px solid var(--ui-focus); outline-offset: 1px; }
.filesearch-btn { position: relative; z-index: 1; }
.toolbar-actions .filesearch.open .filesearch-btn,
.toolbar-actions .filesearch.open .filesearch-btn:hover { border-color: transparent; background: transparent; }
.filesearch-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.filesearch-kbd {
  padding: 1px 6px;
  border: 1px solid var(--ui-border);
  border-radius: 4px;
  background: var(--ui-surface-subtle);
  color: var(--ui-text-muted);
  font: 600 11px/16px var(--ui-font);
}
.toolbar-period {
  height: 36px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius-sm);
  background: var(--ui-surface-subtle);
  color: var(--ui-text-secondary);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.toolbar-period .ui-icon { color: var(--ui-text-muted); }
.toolbar-actions .current-date { color: inherit; font-size: inherit; }
.toolbar-period #yearSelect {
  height: 24px;
  margin-right: -4px;
  padding: 0 4px 0 10px;
  border: 0;
  border-left: 1px solid var(--ui-border);
  border-radius: 0;
  background-color: transparent;
  color: var(--ui-text);
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
}
.toolbar-actions #fillBtn {
  height: 36px;
  min-height: 36px;
  padding: 0 16px;
  border-radius: var(--ui-radius-sm);
  font-size: 13px;
  font-weight: 650;
}
.toolbar-account {
  flex: none;
  padding-left: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-left: 1px solid var(--ui-border);
}
.account-avatar {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  flex: none;
  border-radius: 50%;
  background: var(--ui-primary-soft);
  color: var(--ui-primary);
}
.account-avatar .ui-icon { width: 18px; height: 18px; }
.toolbar-account:not(:has(.logged-in)) .account-avatar { background: var(--ui-surface-subtle); color: var(--ui-text-muted); }
.account-meta { min-width: 0; display: flex; flex-direction: column; gap: 1px; line-height: 1.25; }
.toolbar-actions .auth-status,
.toolbar-actions .auth-status.logged-in {
  max-width: 180px;
  margin: 0;
  overflow: hidden;
  color: var(--ui-text);
  font-size: 13px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.toolbar-account:has(.debug-role-control:not([hidden])) .auth-status { display: none; }
.toolbar-account .debug-role-control select {
  height: 22px;
  min-height: 0;
  max-width: 200px;
  padding: 0 2px 0 0;
  border: 0;
  background-color: transparent;
  color: var(--ui-text);
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
}
.toolbar-actions .conn-status { margin: 0; gap: 6px; color: var(--ui-text-muted); font-size: 12px; white-space: nowrap; }
.debug-role-control {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--shell-muted);
  font-size: 12px;
  white-space: nowrap;
}
.debug-role-control[hidden] { display: none; }
.debug-role-control select {
  min-height: 32px;
  padding: 4px 26px 4px 9px;
  border: 1px solid var(--shell-border);
  border-radius: 8px;
  background: var(--ui-surface);
  color: var(--shell-ink);
  font: inherit;
}

.access-control-modal { width: min(880px, 96vw); max-width: 880px; max-height: min(92vh, 960px); overflow-y: auto; }
.access-control-hint { margin: -4px 0 16px; color: #607086; font-size: 13px; }
.access-control-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 14px; }
.access-control-toolbar label { color: #31465d; font-weight: 700; }
.access-control-toolbar select { min-width: 240px; padding: 8px 10px; border: 1px solid #b9c6d4; border-radius: 6px; font: inherit; }
#accessControlSource { margin: -7px 0 12px; color: #64748b; font-size: 12px; }
.access-control-status { padding: 4px 8px; border-radius: 999px; background: #e9f0f7; color: #486079; font-size: 12px; white-space: nowrap; }
.access-control-status.is-pending { background: #fff3d6; color: #7a5510; }
.access-control-status.is-removal { background: #fbe7e7; color: #8c3030; }
.access-control-add { margin-left: auto; }
.access-control-remove { color: #a13333; }
.access-control-table-wrap { max-height: min(58vh, 560px); overflow: auto; border: 1px solid #dce3eb; border-radius: 8px; }
.access-control-table { width: 100%; border-collapse: collapse; }
.access-control-table th,
.access-control-table td { padding: 10px 12px; border-bottom: 1px solid #e5eaf0; text-align: left; }
.access-control-table th { position: sticky; top: 0; z-index: 1; }
.access-control-table th:not(:first-child),
.access-control-table td:not(:first-child) { width: 120px; text-align: center; }
.access-control-table tr:last-child td { border-bottom: 0; }
.access-control-table input { width: 18px; height: 18px; accent-color: #2368a2; }
.access-control-message { min-height: 20px; margin-top: 10px; color: #256534; font-size: 13px; }
.access-control-message.is-error { color: #9b2929; }
.access-control-actions { display: flex; justify-content: space-between; gap: 12px; margin-top: 10px; }
.access-control-actions-end { justify-content: flex-end; }
.access-control-actions > .btn-apply { margin-left: auto; }
.access-account-fields { display: grid; grid-template-columns: minmax(0, 1fr) repeat(2, minmax(180px, .6fr)); gap: 14px; }
.access-account-fields input,
.access-account-fields select { width: 100%; min-height: 38px; padding: 7px 10px; border: 1px solid #b9c6d4; border-radius: 6px; font: inherit; }
.access-reauth-modal { width: min(460px, 94vw); }
.account-env-modal { width: min(680px, 94vw); }
.account-env-modal textarea { width: 100%; resize: vertical; min-height: 160px; padding: 12px; border: 1px solid #aebccc; border-radius: 7px; background: #f6f8fa; color: #1c2c3d; font: 13px/1.5 ui-monospace, SFMono-Regular, Consolas, monospace; }

.site-warning-admin {
  margin-top: 24px;
  padding-top: 22px;
  border-top: 1px solid var(--ui-border);
}
.site-warning-admin-head {
  margin-bottom: 14px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}
.site-warning-admin-head h3 { margin: 0 0 4px; color: var(--ui-text); font-size: 15px; }
.site-warning-admin-head p { margin: 0; color: var(--ui-text-muted); font-size: 13px; }
.site-warning-enabled {
  min-height: 38px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  border: 1px solid var(--ui-border-strong);
  border-radius: var(--ui-radius-sm);
  color: var(--ui-text-secondary);
  font-weight: 700;
  cursor: pointer;
}
.site-warning-enabled input { width: 18px; height: 18px; accent-color: var(--ui-primary); }
.site-warning-admin textarea { width: 100%; min-height: 92px; resize: vertical; }
.site-warning-counter { display: block; margin-top: 4px; color: var(--ui-text-muted); font-size: 12px; text-align: right; }
.site-warning-fields { display: grid; grid-template-columns: 1fr 1.35fr 1.35fr; gap: 12px; }
.site-warning-fields select,
.site-warning-fields input { width: 100%; min-height: 38px; }
.site-warning-preview {
  min-height: 46px;
  margin-top: 4px;
  padding: 10px 12px;
  display: flex;
  align-items: flex-start;
  gap: 9px;
  border: 1px solid;
  border-radius: var(--ui-radius-md);
  font-weight: 650;
  line-height: 1.4;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}
.site-warning-preview-icon {
  width: 21px;
  height: 21px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid currentColor;
  border-radius: 50%;
  font-size: 13px;
  font-weight: 800;
}
.site-warning-preview--info { border-color: #8ab8ef; background: #eaf3ff; color: #174f91; }
.site-warning-preview--important { border-color: #e1b849; background: #fff4c7; color: #704d00; }
.site-warning-preview--critical { border-color: #e28b8b; background: #fde5e5; color: #8d2020; }
.site-warning-meta { min-height: 18px; margin-top: 8px; color: var(--ui-text-muted); font-size: 12px; }

@media (max-width: 620px) {
  .access-control-toolbar { align-items: stretch; flex-direction: column; }
  .access-control-toolbar select { min-width: 0; width: 100%; }
  .access-control-add { margin-left: 0; }
  .access-account-fields { grid-template-columns: 1fr; gap: 0; }
  .access-control-table th,
  .access-control-table td { padding: 9px 7px; }
  .access-control-actions { flex-direction: column-reverse; }
  .site-warning-admin-head { align-items: stretch; flex-direction: column; }
  .site-warning-enabled { align-self: flex-start; }
  .site-warning-fields { grid-template-columns: 1fr; }
}
.shell-action-proxies { display: none !important; }
.page-heading { display: none; }

.dashboard-state-notice {
  order: 0;
  width: 100%;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius-md);
  background: var(--ui-surface-subtle);
  color: var(--ui-text-secondary);
  font-size: 13px;
}

.dashboard-state-notice[hidden] { display: none !important; }
.dashboard-state-notice.is-error {
  border-color: #efc7c3;
  background: #fff5f4;
  color: #9d2f28;
}

@media (max-width: 900px) {
  body.shell-ready { padding-left: 0; }
  .shell-sidebar { width: min(300px, 86vw); transform: translateX(-100%); }
  body.shell-drawer-open .shell-sidebar { transform: translateX(0); }
  body.shell-drawer-open .shell-scrim { display: block; }
  .shell-mobile-toggle { display: inline-grid; place-items: center; }
  .container { padding: 18px 14px 36px; }
  .dashboard-toolbar { align-items: center; }
  body.shell-page-active .dashboard-toolbar,
  body.shell-contracts-active .dashboard-toolbar {
    min-height: 44px;
    margin-bottom: 18px;
    padding-bottom: 0;
    display: flex;
    border-bottom: 0;
  }
  body.shell-page-active .dashboard-toolbar > :not(.shell-mobile-toggle):not(.toolbar-context),
  body.shell-contracts-active .dashboard-toolbar > :not(.shell-mobile-toggle):not(.toolbar-context) {
    display: none;
  }
  .toolbar-actions { flex-wrap: wrap; }
  .toolbar-context { min-width: 0; }
}

/* Sidebar destinations are full content pages, not modal windows. */
body.shell-page-active .container > .grid,
body.shell-page-active .container > .page-heading {
  display: none !important;
}

/* Pages start where the contracts card starts, not below the empty container. */
body.shell-page-active .container {
  padding-bottom: 0;
}

.modal-overlay.shell-page-panel {
  position: static !important;
  inset: auto !important;
  z-index: auto !important;
  width: auto !important;
  min-height: 0 !important;
  padding: 0 clamp(20px, 3vw, 52px) 48px !important;
  align-items: stretch !important;
  justify-content: stretch !important;
  overflow: visible !important;
  background: transparent !important;
  backdrop-filter: none !important;
}

.modal-overlay.shell-page-panel:not(.active) { display: none !important; }
.modal-overlay.shell-page-panel.active { display: block !important; }

.shell-page-panel > .modal,
.shell-page-panel > .assign-panels,
.shell-page-panel > .assign-panels > .modal {
  position: relative !important;
  top: auto !important;
  right: auto !important;
  bottom: auto !important;
  left: auto !important;
  width: 100% !important;
  max-width: none !important;
  max-height: none !important;
  margin: 0 !important;
  overflow: visible !important;
  border: 1px solid var(--ui-border) !important;
  border-radius: var(--ui-radius-lg) !important;
  background: var(--ui-surface) !important;
  box-shadow: var(--ui-shadow-xs) !important;
}

.shell-page-panel > .modal,
.shell-page-panel > .assign-panels > .modal {
  padding: 24px !important;
}

.shell-page-panel > .assign-panels {
  display: grid !important;
  grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr);
  gap: 16px;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

.shell-page-panel .shell-page-heading {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* The contracts registry has its own sidebar destination. */
.grid > .table-card {
  display: none !important;
}

body.shell-contracts-active .grid > .summary-row,
body.shell-contracts-active .grid > .metrics-section,
body.shell-contracts-active .grid > .test-section {
  display: none !important;
}

body.shell-contracts-active .grid > .table-card {
  display: flex !important;
  grid-column: 1 / -1;
  max-height: none;
}

body.shell-contracts-active #incomeTableWrap,
body.shell-contracts-active #expenseTableWrap {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  overflow: auto;
}

#projectModal.shell-page-panel .modal-table-card,
#projectWorkModal.shell-page-panel .modal-table-card {
  height: auto;
  /* .table-card at >=1920px caps max-height; .pw-panel clips, so the page would stop scrolling. */
  max-height: none;
}

/* the tenders table gets the full viewport height while the summary above scrolls away with the page */
#tendersModal.shell-page-panel .kvz-wrap {
  max-height: calc(100dvh - 120px);
}

.risk-reminder {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 90;
  width: min(390px, calc(100vw - 48px));
  overflow: hidden;
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius-lg);
  background: var(--ui-surface);
  box-shadow: var(--ui-shadow-md);
  color: var(--ui-text);
  transform-origin: calc(100% - 22px) calc(100% - 22px);
}

.risk-reminder[hidden] { display: none !important; }
.risk-reminder.is-collapsing,
.risk-reminder.is-expanding {
  pointer-events: none;
  will-change: opacity, transform;
}
.risk-reminder.is-collapsing {
  animation: risk-reminder-collapse .28s cubic-bezier(.4, 0, .7, .2) both;
}
.risk-reminder.is-expanding {
  animation: risk-reminder-expand .28s cubic-bezier(.2, .7, .2, 1) both;
}

.risk-reminder-bell {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 90;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--ui-border);
  border-radius: 50%;
  background: var(--ui-surface);
  box-shadow: var(--ui-shadow-md);
  color: var(--ui-danger);
  cursor: pointer;
  animation: risk-reminder-bell-enter .24s ease-out both;
}

.risk-reminder-bell[hidden] { display: none !important; }
.risk-reminder-bell.is-static { animation: none; }
.risk-reminder-bell:hover { background: var(--ui-primary-soft); }
.risk-reminder-bell:focus-visible { outline: 3px solid var(--ui-primary); outline-offset: 3px; }
.risk-reminder-bell svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }

@keyframes risk-reminder-bell-enter {
  from { opacity: 0; transform: translate(12px, 12px) scale(.8); }
  to { opacity: 1; transform: translate(0, 0) scale(1); }
}

@keyframes risk-reminder-collapse {
  from { opacity: 1; transform: scale(1); }
  70% { opacity: .82; }
  to { opacity: 0; transform: scale(.11); }
}

@keyframes risk-reminder-expand {
  from { opacity: 0; transform: scale(.11); }
  30% { opacity: .82; }
  to { opacity: 1; transform: scale(1); }
}

.risk-reminder-head {
  padding: 14px 14px 12px 16px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--ui-border);
}

.risk-reminder-eyebrow {
  display: block;
  margin-bottom: 2px;
  color: var(--ui-danger);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.risk-reminder-head h2 {
  margin: 0;
  font-size: 16px;
  line-height: 1.3;
}

.risk-reminder-close {
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: var(--ui-radius-sm);
  background: transparent;
  color: var(--ui-text-muted);
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
}

.risk-reminder-close:hover { background: var(--ui-surface-subtle); color: var(--ui-text); }

.risk-reminder-body {
  max-height: min(360px, 45dvh);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.risk-reminder-item {
  width: 100%;
  padding: 11px 14px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  border: 0;
  border-bottom: 1px solid var(--ui-border);
  color: inherit;
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.risk-reminder-item:hover { filter: brightness(.985); }
.risk-reminder-item:focus-visible { outline: 3px solid var(--ui-primary); outline-offset: -3px; }
.risk-reminder-item.risk-warn { background: #fff7e0; }
.risk-reminder-item.risk-over { background: #fdecea; }

.risk-reminder-contract,
.risk-reminder-deadline {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.risk-reminder-contract strong,
.risk-reminder-contract span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.risk-reminder-contract strong { font-size: 13px; }
.risk-reminder-contract span,
.risk-reminder-deadline span { color: var(--ui-text-muted); font-size: 12px; }
.risk-reminder-deadline { align-items: flex-end; text-align: right; white-space: nowrap; }
.risk-reminder-deadline strong { color: #a6781a; font-size: 12px; }
.risk-reminder-item.risk-over .risk-reminder-deadline strong { color: var(--ui-danger); }

.risk-reminder-open {
  width: 100%;
  min-height: 42px;
  border: 0;
  background: var(--ui-surface);
  color: var(--ui-primary);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
}

.risk-reminder-open:hover { background: var(--ui-primary-soft); }

@keyframes contract-jump-highlight {
  0%, 50% { box-shadow: inset var(--jump-l, 0) 0 0 #e0a62b, inset var(--jump-r, 0) 0 0 #e0a62b, inset 0 2px 0 #e0a62b, inset 0 -2px 0 #e0a62b, inset 0 0 0 999px rgba(255, 193, 7, .38); }
  25%, 75% { box-shadow: inset var(--jump-l, 0) 0 0 #e0a62b, inset var(--jump-r, 0) 0 0 #e0a62b, inset 0 2px 0 #e0a62b, inset 0 -2px 0 #e0a62b, inset 0 0 0 999px rgba(255, 193, 7, .12); }
  100% { box-shadow: inset var(--jump-l, 0) 0 0 rgba(224, 166, 43, 0), inset var(--jump-r, 0) 0 0 rgba(224, 166, 43, 0), inset 0 2px 0 rgba(224, 166, 43, 0), inset 0 -2px 0 rgba(224, 166, 43, 0), inset 0 0 0 999px rgba(255, 193, 7, 0); }
}

/* рамка вокруг всей строки: верх и низ на каждой ячейке, бока только на крайних */
.table-scroll tbody tr.contract-jump-highlight > td:first-child { --jump-l: 4px; }
.table-scroll tbody tr.contract-jump-highlight > td:last-child { --jump-r: -2px; }
.table-scroll tbody tr.contract-jump-highlight > td {
  box-shadow: inset var(--jump-l, 0) 0 0 #e0a62b, inset var(--jump-r, 0) 0 0 #e0a62b, inset 0 2px 0 #e0a62b, inset 0 -2px 0 #e0a62b, inset 0 0 0 999px rgba(255, 193, 7, .25);
}
.table-scroll tbody tr.contract-jump-highlight.is-jump-active > td {
  animation: contract-jump-highlight 2.4s ease-in-out forwards;
}
.table-scroll tbody tr.contract-jump-parent > td:first-child { box-shadow: inset 4px 0 0 #e0a62b; }
tr.contract-jump-highlight:focus { outline: none; }

@media (prefers-reduced-motion: reduce) {
  .risk-reminder,
  .risk-reminder-bell { animation: none; }

  .table-scroll tbody tr.contract-jump-highlight.is-jump-active > td { animation: none; }
}

/* switching sections (sidebar): old content leaves fast, new one rises in; sidebar stays put */
@keyframes vt-out { to { opacity: 0; transform: translateY(-6px); } }
@keyframes vt-in { from { opacity: 0; transform: translateY(12px); } }
::view-transition-group(root) { animation: none; }
::view-transition-old(root), ::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
::view-transition-old(section), ::view-transition-new(section) { mix-blend-mode: normal; }
::view-transition-old(section) { animation: vt-out 130ms cubic-bezier(.5, 0, 1, 1) both; }
::view-transition-new(section) { animation: vt-in 240ms cubic-bezier(.16, 1, .3, 1) both; }

@media (max-width: 640px) {
  .risk-reminder {
    right: 14px;
    bottom: calc(14px + env(safe-area-inset-bottom));
    width: calc(100vw - 28px);
  }

  .risk-reminder-bell {
    right: 14px;
    bottom: calc(14px + env(safe-area-inset-bottom));
  }

  .risk-reminder-body { max-height: min(320px, 42dvh); }
}

.birthday-modal { width: min(100%, 1120px) !important; max-width: 1120px !important; }
.birthday-layout {
  display: grid;
  grid-template-columns: minmax(280px, .8fr) minmax(460px, 1.2fr);
  gap: 24px;
  align-items: start;
}
.birthday-list {
  min-width: 0;
  padding: 4px 16px;
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius-md);
  background: var(--ui-surface-subtle);
}
.birthday-calendars { display: grid; gap: 14px; }
.birthday-calendar {
  padding: 14px;
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius-md);
  background: var(--ui-surface);
  box-shadow: var(--ui-shadow-xs);
}
.birthday-calendar-title {
  margin: 0 0 10px;
  color: var(--ui-text);
  font-size: 15px;
  font-weight: 700;
  text-transform: capitalize;
}
.birthday-calendar-weekdays,
.birthday-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
}
.birthday-calendar-weekdays { margin-bottom: 4px; }
.birthday-calendar-weekdays span {
  padding: 2px;
  color: var(--ui-text-muted);
  font-size: 12px;
  font-weight: 650;
  text-align: center;
}
.birthday-calendar-day {
  min-height: 52px;
  padding: 5px 6px;
  border: 1px solid #edf0f3;
  border-radius: 7px;
  background: var(--ui-surface);
  color: var(--ui-text-secondary);
  font-size: 12px;
}
.birthday-calendar-day.is-empty { border-color: transparent; background: transparent; }
.birthday-calendar-day.has-birthday {
  border-color: #efb8b4;
  background: #fff3f2;
  color: #a72e27;
  box-shadow: inset 3px 0 0 #d94a42;
}
.birthday-calendar-day.is-today { outline: 2px solid var(--ui-primary); outline-offset: -2px; }
.birthday-calendar-number { display: block; font-size: 12px; font-weight: 700; }
.birthday-calendar-names {
  display: block;
  margin-top: 3px;
  overflow: hidden;
  color: inherit;
  font-size: 12px;
  line-height: 1.2;
  text-overflow: ellipsis;
}

@media (max-width: 900px) {
  .modal-overlay.shell-page-panel {
    padding: 0 14px 36px !important;
  }

  .shell-page-panel > .assign-panels {
    grid-template-columns: minmax(0, 1fr);
  }

  .shell-page-panel > .modal,
  .shell-page-panel > .assign-panels > .modal {
    width: 100% !important;
    max-width: none !important;
    padding: 18px 14px !important;
  }

  .birthday-layout { grid-template-columns: minmax(0, 1fr); }
  .birthday-calendars { min-width: 0; }
}

/* Mobile dashboard: keep every workflow available from 360px through 900px. */
@media (max-width: 900px) {
  html,
  body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  body.shell-drawer-open,
  body.ui-overlay-open {
    overscroll-behavior: contain;
  }

  body.shell-ready {
    padding-left: 0;
  }

  .container {
    min-width: 0;
    padding: 18px 14px calc(36px + env(safe-area-inset-bottom));
  }

  .shell-sidebar {
    width: min(300px, 86vw);
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
    transform: translateX(-100%);
    overscroll-behavior: contain;
  }

  body.shell-drawer-open .shell-sidebar {
    transform: translateX(0);
  }

  .shell-nav-item,
  .shell-mobile-toggle {
    min-height: 44px;
  }

  .shell-mobile-toggle {
    width: 44px;
    height: 44px;
    display: inline-grid;
    place-items: center;
  }

  .dashboard-toolbar {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
    padding-bottom: 14px;
  }

  .toolbar-context {
    min-width: 0;
  }

  .toolbar-context h1 {
    font-size: 17px;
    overflow-wrap: anywhere;
  }

  .toolbar-actions {
    grid-column: 1 / -1;
    width: 100%;
    min-width: 0;
    margin-left: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
  }

  .toolbar-actions .month-select,
  .toolbar-actions button,
  .toolbar-actions select,
  .debug-role-control select {
    min-height: 44px;
  }

  .toolbar-actions .current-date,
  .toolbar-actions .conn-status,
  .toolbar-actions .auth-status {
    min-width: 0;
  }

  .toolbar-actions .filesearch { flex: 0 0 auto; }
  .filesearch-kbd { display: none; }
  .toolbar-period { height: 44px; }

  .summary-row,
  .gauges-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .summary-row .info-box,
  .gauges-row .card,
  .test-section,
  .table-card {
    min-width: 0;
  }

  .summary-row .info-box-value {
    font-size: clamp(19px, 4vw, 24px);
    overflow-wrap: anywhere;
  }

  .gauges-row .gauge-svg {
    width: min(100%, 240px);
  }

  .forecast-card,
  .forecast-main,
  .forecast-scales {
    min-width: 0;
    max-width: 100%;
  }

  body.shell-contracts-active .grid > .table-card {
    width: 100%;
    min-width: 0;
    overflow: hidden;
  }

  .table-filters-bar,
  .table-bottom-bar,
  .table-tabs,
  .kvz-toolbar,
  .client-head,
  .perf-period,
  .vac-form-actions,
  .assign-actions {
    min-width: 0;
    flex-wrap: wrap;
  }

  .table-scroll,
  .closing-wrap,
  .kvz-wrap,
  #riskBody,
  #gaugeModalBody,
  .executor-card-table-wrap,
  #incomeMonthBody,
  #signedBody,
  #kvzSecureBody {
    display: block;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scrollbar-gutter: stable;
    -webkit-overflow-scrolling: touch;
  }

  .table-scroll table,
  .closing-wrap table,
  .kvz-wrap table,
  #riskBody table,
  #gaugeModalBody table,
  .executor-card-table-wrap table,
  #incomeMonthBody table,
  #signedBody table,
  #kvzSecureBody table {
    width: max-content;
    max-width: none;
  }

  #incomeTableWrap table,
  #expenseTableWrap table {
    min-width: 1120px;
  }

  #incomeTableWrap th:first-child,
  #expenseTableWrap th:first-child,
  #incomeTableWrap td:first-child,
  #expenseTableWrap td:first-child {
    position: sticky;
    left: 0;
    z-index: 2;
    background: var(--ui-surface);
    box-shadow: 1px 0 0 var(--ui-border);
  }

  #incomeTableWrap thead th:first-child,
  #expenseTableWrap thead th:first-child {
    z-index: 4;
    background: #f1f4f8;
  }

  #incomeTableWrap tr.st-project > td:first-child,
  #expenseTableWrap tr.st-project > td:first-child {
    background: #f4f5f7;
  }

  #incomeTableWrap tr.st-work > td:first-child,
  #expenseTableWrap tr.st-work > td:first-child {
    background: var(--ui-primary-soft);
  }

  #incomeTableWrap tr.st-done > td:first-child,
  #expenseTableWrap tr.st-done > td:first-child {
    background: #edf8f1;
  }

  .filters-popup {
    position: fixed;
    top: max(72px, calc(env(safe-area-inset-top) + 60px));
    right: 14px;
    left: 14px;
    width: auto;
    max-width: 460px;
    max-height: calc(100dvh - 88px - env(safe-area-inset-bottom));
    overflow-y: auto;
  }

  .contract-kind-actions .filters-popup {
    left: 14px;
    right: 14px;
  }

  .filesearch.open .filesearch-input { width: 170px; }
  .filesearch-pop {
    position: fixed;
    top: max(72px, calc(env(safe-area-inset-top) + 60px));
    right: 14px;
    left: 14px;
    width: auto;
    max-width: 520px;
  }

  .modal-overlay.shell-page-panel {
    width: 100% !important;
    min-width: 0 !important;
    padding: 0 14px calc(36px + env(safe-area-inset-bottom)) !important;
  }

  .shell-page-panel > .modal,
  .shell-page-panel > .assign-panels,
  .shell-page-panel > .assign-panels > .modal {
    min-width: 0 !important;
    overflow: visible !important;
  }

  .shell-page-panel > .assign-panels {
    grid-template-columns: minmax(0, 1fr);
  }

  .shell-page-panel input:not([type="checkbox"]):not([type="radio"]),
  .shell-page-panel select,
  .shell-page-panel textarea {
    max-width: 100%;
  }

  .changes-head,
  .client-contact,
  .client-files,
  .birthday-layout,
  .birthday-calendars,
  .vac-body,
  .vac-left,
  .vac-right {
    min-width: 0;
    max-width: 100%;
  }

  .birthday-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .vac-body {
    flex-direction: column;
  }

  .vac-left,
  .vac-right,
  .vac-weekdays,
  .vac-grid {
    width: 100%;
  }

  .vac-left {
    flex: 0 1 auto;
  }

  .vac-grid {
    height: auto;
    grid-auto-rows: minmax(64px, 1fr);
  }

  .vac-right {
    flex-basis: auto;
  }

  .pw-tabs {
    min-width: 0;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
  }

  .pw-tab {
    min-height: 44px;
  }
}

@media (max-width: 640px) {
  .container {
    padding-right: 12px;
    padding-left: 12px;
  }

  .dashboard-toolbar {
    gap: 10px;
  }

  .toolbar-context .page-eyebrow {
    display: none;
  }

  .toolbar-context h1 {
    font-size: 16px;
  }

  .toolbar-actions {
    display: flex;
    flex-wrap: wrap;
  }

  .toolbar-actions .filesearch { flex-basis: 100%; }
  .toolbar-period { display: none; }
  .toolbar-account { order: 1; padding-left: 0; border-left: 0; }

  .toolbar-actions .btn-fill { order: 2; margin-left: auto; }

  .summary-row,
  .gauges-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .summary-row .info-box {
    min-height: 82px;
  }

  .gauges-row .card,
  .test-section {
    padding: 14px;
  }

  .gauges-row .gauge-svg {
    max-width: 240px;
  }

  .forecast-card {
    flex-direction: column;
    gap: 14px;
  }

  .forecast-scales {
    align-self: stretch;
    justify-content: start;
  }

  .table-filters-bar,
  .table-bottom-bar {
    padding: 10px;
  }

  .table-filters-bar .risk-right {
    width: 100%;
    margin-left: 0;
  }

  .table-bottom-bar {
    overflow-x: auto;
  }

  .table-tabs {
    width: max-content;
  }

  .modal-overlay:not(.shell-page-panel) {
    padding: 0 !important;
    align-items: stretch;
    justify-content: stretch;
  }

  .modal-overlay:not(.shell-page-panel) > .modal {
    width: 100% !important;
    max-width: none !important;
    height: 100dvh !important;
    max-height: 100dvh !important;
    margin: 0 !important;
    padding: calc(14px + env(safe-area-inset-top)) 14px calc(18px + env(safe-area-inset-bottom)) !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    overscroll-behavior: contain;
    border: 0 !important;
    border-radius: 0 !important;
  }

  .modal-overlay:not(.shell-page-panel) > .modal > h2 {
    position: sticky;
    top: calc(-14px - env(safe-area-inset-top));
    z-index: 4;
    margin: calc(-14px - env(safe-area-inset-top)) -14px 16px;
    padding: calc(16px + env(safe-area-inset-top)) 58px 14px 14px;
    border-bottom: 1px solid var(--ui-border);
    background: rgba(255, 255, 255, 0.97);
    font-size: 17px;
    backdrop-filter: blur(10px);
  }

  .modal-overlay:not(.shell-page-panel) > .modal > .modal-close,
  .modal-overlay:not(.shell-page-panel) > .modal > .modal-corner {
    position: sticky !important;
    top: max(8px, env(safe-area-inset-top)) !important;
    right: auto !important;
    z-index: 7;
    margin-left: auto;
    margin-bottom: -44px;
  }

  .modal-overlay:not(.shell-page-panel) > .modal > .modal-close {
    width: 44px;
    height: 44px;
  }

  .modal-overlay:not(.shell-page-panel) > .modal > .modal-corner {
    width: max-content;
    min-height: 44px;
  }

  .modal-overlay:not(.shell-page-panel) > .modal > .modal-corner .modal-close {
    width: 44px;
    height: 44px;
  }

  .modal-overlay:not(.shell-page-panel) input:not([type="checkbox"]):not([type="radio"]),
  .modal-overlay:not(.shell-page-panel) select,
  .modal-overlay:not(.shell-page-panel) textarea {
    max-width: 100%;
  }

  .admin-panel-inner {
    inset: 0 !important;
    width: 100% !important;
    max-width: none !important;
    height: 100dvh;
    padding: calc(64px + env(safe-area-inset-top)) 14px calc(18px + env(safe-area-inset-bottom));
    border: 0;
    overflow-y: auto;
  }

  .admin-panel-close {
    top: calc(12px + env(safe-area-inset-top));
    width: 44px;
    height: 44px;
  }

  .admin-box .row,
  .changes-board {
    grid-template-columns: minmax(0, 1fr);
  }

  .assign-name-row,
  .assign-add,
  .client-contact .contact-row,
  .kvz-secure-add {
    align-items: stretch;
    flex-direction: column;
  }

  .assign-name-row label,
  .assign-add input,
  .client-contact input[data-key],
  .kvz-secure-add select,
  .kvz-secure-add input {
    width: 100%;
    min-width: 0;
  }

  .client-contact label.contact-row > span {
    flex-basis: auto;
  }

  .client-file,
  .client-folder,
  .client-folder-bar {
    flex-wrap: wrap;
  }

  .vac-nav {
    gap: 8px;
  }

  .vac-month {
    min-width: 0;
    flex: 1;
    font-size: 15px;
  }

  .vac-grid {
    grid-auto-rows: minmax(54px, 1fr);
  }

  .birthday-calendar {
    padding: 10px;
  }

  .birthday-calendar-day {
    min-height: 44px;
    padding: 4px;
  }

  .birthday-calendar-names {
    font-size: 12px;
  }

  .pw-tabs {
    flex-wrap: nowrap;
    margin-left: 0;
  }

  .pw-tab {
    flex: 0 0 min(82vw, 300px);
  }
}

@media (max-width: 1050px) {
  .meet-calendars {
    grid-template-columns: minmax(0, 1fr);
  }

}

@media (max-width: 640px) {
  .forecast-chart-panel {
    padding: 12px;
  }

  .forecast-chart-head,
  .forecast-legend {
    gap: 8px;
  }

  .forecast-bars {
    padding-right: 4px;
    padding-left: 4px;
  }

  .forecast-bars.has-year-battery {
    grid-template-columns: minmax(0, 1fr) 6px minmax(180px, .46fr);
    gap: 2px;
  }

  .forecast-history {
    grid-template-columns: repeat(var(--history-months), minmax(14px, 1fr));
    gap: 2px;
    margin-left: 0;
  }

  .forecast-axis-tick > span {
    display: none;
  }

  .forecast-bar-deviation {
    font-size: 12px;
    transform: translateX(-50%) rotate(-55deg);
    transform-origin: center bottom;
  }

  .forecast-year-battery {
    padding-right: 2px;
    padding-left: 2px;
  }

  .forecast-battery-shell {
    width: min(calc(100% - 18px), max(70%, 160px));
    height: 76px;
  }

  .forecast-year-divider::before {
    left: calc(50% + 6px);
  }

  .forecast-battery-percent {
    top: -30px;
    font-size: 20px;
  }

  .forecast-battery-shell.fact-outside .forecast-battery-fill strong {
    right: calc(100% + 8px);
  }

  .forecast-battery-shell.remaining-outside .forecast-battery-remaining strong {
    left: calc(100% + 8px);
  }

  #meetModal > .meet-modal { padding: var(--ui-space-2) !important; }
  .meet-nav-controls { justify-self: center; }
  .meet-month { min-width: 0; }
  .meet-calendar-panel { padding: var(--ui-space-2); }
  .meet-day { min-height: 60px; padding: 2px; }
  .meet-day-heading { flex-wrap: wrap; line-height: 1.15; }
  .meet-count { padding-inline: 2px; }
  .meet-preview { padding-inline: 1px; gap: 2px; font-size: 10px; }
  .meet-preview + .meet-preview { display: none; }
}

@media (max-width: 900px) and (pointer: coarse) {
  .dashboard-toolbar button,
  .dashboard-toolbar select,
  .shell-page-panel button,
  .shell-page-panel select,
  .modal-overlay:not(.shell-page-panel) button,
  .modal-overlay:not(.shell-page-panel) select,
  .admin-panel button,
  .admin-panel select,
  .kvz-import-label {
    min-height: 44px;
  }

  body.admin-mode .col-actions {
    width: 48px;
  }

  .row-delete {
    visibility: visible;
  }
}

@media (max-width: 900px) {
  #monthSelect,
  #yearSelect,
  #logoutBtn {
    display: none !important;
  }

  .toolbar-actions #fillBtn {
    height: 44px;
    min-height: 44px;
  }
}

.app-confirm-modal {
  max-width: 440px;
}

.app-confirm-message {
  margin: 0;
  color: var(--ui-text-secondary);
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.app-confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
}

.app-confirm-actions button {
  min-width: 104px;
  min-height: 40px;
  padding: 8px 16px;
  border-radius: var(--ui-radius-sm);
  cursor: pointer;
}

.app-confirm-accept {
  border: 1px solid #b42318;
  background: #b42318;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
}

.app-confirm-accept:hover {
  border-color: #8f1c13;
  background: #8f1c13;
}

@media (max-width: 900px) {
  .modal-overlay.app-confirm-overlay {
    padding: 16px !important;
    align-items: center;
    justify-content: center;
  }

  .modal-overlay.app-confirm-overlay > .app-confirm-modal {
    width: min(100%, 440px) !important;
    max-width: 440px !important;
    height: auto !important;
    max-height: calc(100dvh - 32px) !important;
    margin: 0 !important;
    padding: 24px !important;
    border: 1px solid var(--ui-border) !important;
    border-radius: var(--ui-radius-lg) !important;
  }

  .modal-overlay.app-confirm-overlay > .app-confirm-modal > h2 {
    position: static;
    margin: 0 0 16px;
    padding: 0 48px 0 0;
    border: 0;
    background: transparent;
    backdrop-filter: none;
  }

  .modal-overlay.app-confirm-overlay > .app-confirm-modal > .modal-close {
    position: absolute !important;
    top: 10px !important;
    right: 12px !important;
    width: 44px;
    height: 44px;
    margin: 0;
  }

  .app-confirm-actions {
    flex-direction: column-reverse;
  }

  .app-confirm-actions button {
    width: 100%;
  }
}

.column-resize-handle {
  position: absolute; right: 0; top: 0; bottom: 0; width: 24px;
  cursor: col-resize; touch-action: none; user-select: none; z-index: 4;
}
.column-resize-handle::after {
  position: absolute; top: 0; right: 0; bottom: 0; width: 2px;
  background: transparent; content: "";
}
.column-resize-handle:hover::after, .column-resize-handle:focus-visible::after {
  background: #3578b8;
}
.user-column-widths { table-layout: fixed !important; }
.user-column-widths > :is(thead, tbody, tfoot) > tr > :is(th, td) {
  min-width: 0 !important; overflow-wrap: anywhere; overflow: hidden;
}
.user-column-widths > :is(thead, tbody, tfoot) > tr > :is(th, td) :is(input, select, textarea) {
  min-width: 0 !important; max-width: 100%; box-sizing: border-box;
}
@media print { .column-resize-handle { display: none; } }

/* Future-year gauges share the signed-contract card. */
.signed-gauge-cluster { position: relative; width: min(100%, 274px); padding-bottom: 26px; }
.gauges-row .signed-gauge-cluster > .gauge-svg { display: block; width: min(100%, 240px); margin-inline: auto; }
.signed-future-gauges { position: absolute; right: 0; bottom: 0; left: 0; display: flex; justify-content: space-between; }
.gauges-row .gauge-card-signed > .gauge-wrap { flex-direction: column; align-items: center; gap: 6px; }
.gauges-row .gauge-card-signed .remaining-info { margin-top: 0; }
.signed-mini { width: min(70px, 25%); min-width: 0; border: 0; background: transparent; color: inherit; padding: 0; cursor: pointer; font: inherit; text-align: center; }
.signed-mini:focus-visible { outline: 2px solid var(--ui-primary); border-radius: 8px; }
.gauges-row .signed-mini .gauge-svg { width: min(100%, 70px); }
.signed-mini-gauge-wrap { display: flex; justify-content: center; }
.signed-mini-year-backdrop { fill: var(--ui-surface, #fff); }
.signed-mini-year { font-size: 30px; }
.birthday-form:not([hidden]) { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; margin: 0 0 12px; }
.birthday-form label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; }
.birthday-form input { max-width: 100%; box-sizing: border-box; border: 1px solid var(--ui-border); border-radius: 6px; padding: 7px; }
#birthdayMessage { font-size: 12px; margin-bottom: 10px; }
.contract-save-status { font-size: 12px; color: var(--ui-text-secondary); }
.contract-save-status.is-error { color: #b42318; }

.contract-save-notice:not([hidden]) { position: fixed; z-index: var(--ui-z-notice); right: 18px; bottom: 18px; display: flex; align-items: center; flex-wrap: wrap; gap: 12px; max-width: min(520px, calc(100vw - 36px)); padding: 10px 16px; border: 1px solid var(--ui-border); border-radius: 8px; background: var(--ui-surface); box-shadow: var(--ui-shadow-xs); }
.contract-save-status { overflow-wrap: anywhere; }

.app-confirm-modal [hidden] { display: none !important; }
.app-confirm-field { display: grid; gap: 6px; margin-top: 12px; color: var(--ui-text-secondary); }
.app-confirm-field input { min-height: var(--ui-control-height, 40px); padding: 8px 10px; border: 1px solid var(--ui-border); border-radius: var(--ui-radius-sm, 6px); color: var(--ui-text); font: inherit; }
.app-confirm-field input:focus-visible { outline: 2px solid var(--ui-focus); outline-offset: 1px; }
.app-confirm-accept.is-primary { border-color: var(--ui-primary); background: var(--ui-primary); }
.app-confirm-accept.is-primary:hover { border-color: var(--ui-primary-hover); background: var(--ui-primary-hover); }

.app-toasts { position: fixed; z-index: var(--ui-z-toast); top: 16px; right: 16px; display: grid; gap: 8px; width: min(380px, calc(100vw - 32px)); pointer-events: none; }
.app-toast { padding: 10px 14px; border: 1px solid var(--ui-border); border-left: 4px solid var(--ui-primary); border-radius: 8px; background: var(--ui-surface); color: var(--ui-text); box-shadow: var(--ui-shadow-xs); overflow-wrap: anywhere; pointer-events: auto; }
.app-toast-success { border-left-color: var(--ui-success); }
.app-toast-error { border-left-color: var(--ui-danger); }

/* compact table controls keep a 24px pointer target */
:is(.exec-edit, .expense-exec-edit, .pl-edit-toggle, .pl-del, .pwi-del, .pw-row-del, .proj-client-files, .ps-del,
  .proj-row-del, .kvz-del, .vac-del, .cf-del, .folder-ren, .folder-ren-bar, .file-ren, .folder-del, .file-del,
  .contract-number-numbering-button, .contract-number-files, .stage-request-add-row-btn, .request-stage-toggle, .add-row-bar,
  .perf-dept-move, .kvz-secure-open, .kvz-note-del, .research-name, .proj-stage-toggle, .pw-name-view, .risk-target-btn) {
  min-width: 24px;
  min-height: 24px;
}
:is(#incomeTableWrap, #expenseTableWrap, #projectTable, .kvz-table) :is(select, input:not([type="checkbox"], [type="radio"], [type="hidden"])) {
  min-height: 24px;
}
.ui-icon-lead { margin-right: 6px; }
