.app {
  min-height: 100vh;
}
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  width: var(--sidebar-width);
  background: var(--surface);
  border-right: 1px solid var(--line);
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  height: var(--topbar-height);
  padding: 0 24px;
  flex: 0 0 auto;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
  color: inherit;
}
.brand-lockup {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 100%;
}
.brand-logo {
  display: block;
  width: auto;
  max-width: 100%;
  height: 46px;
  object-fit: contain;
  flex: 0 0 auto;
}
.brand-name {
  line-height: 1.3;
  font-size: 16px;
  font-weight: 700;
  white-space: nowrap;
}
.brand-name small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 400;
}
.nav-scroll {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 20px 12px;
}
.nav-scroll::after {
  content: "";
  flex: 1 0 0;
  margin: 20px -12px -20px;
  pointer-events: none;
  background:
    radial-gradient(circle at 90% 82%, #eaf2ff 0 90px, #dfebfd 91px 124px, #e5effd 125px 158px, #ecf3ff 159px 192px, transparent 193px),
    linear-gradient(150deg, #f8fbff, #e8f0fc);
  mask-image: linear-gradient(transparent, #000 64px);
}
.nav-group + .nav-group {
  margin-top: 24px;
}
.nav-label {
  padding: 0 12px 8px;
  color: var(--muted);
  font-size: 11px;
  line-height: 20px;
}
.nav-list {
  flex: 0 0 auto;
  display: grid;
  gap: 4px;
}
.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  color: #536176;
  text-decoration: none;
  font-size: 13px;
  text-align: left;
}
.nav-secret {
  display: inline-grid;
  place-items: center;
  flex: 0 0 18px;
  height: 18px;
  margin-left: auto;
  border: 1px solid #e6c6c6;
  border-radius: 3px;
  color: #a45555;
  background: #fff8f8;
  font-size: 10px;
  font-weight: 500;
  line-height: 1;
}
.nav-item:hover {
  background: #f6f8fb;
  color: var(--text);
}
.nav-item.active {
  background: var(--brand-soft);
  border-color: #d9e5f8;
  color: var(--brand-dark);
  font-weight: 600;
}
.nav-item[aria-disabled="true"] {
  cursor: default;
}
.nav-icon {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  color: #748197;
}
.nav-item.active .nav-icon {
  color: var(--brand);
}
.nav-icon svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.profile {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.avatar {
  display: grid;
  place-items: center;
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  border: 1px solid #d8e1ef;
  border-radius: 50%;
  color: #365d99;
  background: #eef3fb;
  font-size: 11px;
}
.profile-name {
  color: #344157;
  font-size: 12px;
  white-space: nowrap;
}
.workspace {
  min-height: 100vh;
  margin-left: var(--sidebar-width);
  padding-top: var(--topbar-height);
}
.topbar {
  position: fixed;
  top: 0;
  right: 0;
  left: var(--sidebar-width);
  z-index: 15;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--topbar-height);
  padding: 0 var(--panel-padding);
  border-bottom: 1px solid var(--line);
  background: #fff;
}
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #7d8999;
  font-size: 12px;
}
.breadcrumb-current {
  color: #354156;
  font-weight: 600;
}
.breadcrumb-separator {
  color: #b0b8c3;
}
.topbar-right,
.top-user {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #47566c;
  font-size: 12px;
}
.main {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: var(--section-gap);
  max-width: 1760px;
  margin: 0 auto;
  padding: var(--panel-padding);
}
.main > * {
  grid-column: 1 / -1;
  min-width: 0;
}
.page-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--grid-gap);
}
h1 {
  margin: 0;
  font-size: 24px;
  line-height: 32px;
  font-weight: 650;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--control-height);
  padding: 0 16px;
  border: 1px solid #cfd7e2;
  border-radius: 4px;
  background: #fff;
  color: #3e4c60;
  font-size: 13px;
  line-height: 1;
  white-space: nowrap;
}
.btn:hover {
  background: #f7f9fc;
  border-color: #aebdd0;
}
.btn-primary {
  min-width: 104px;
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
  font-weight: 600;
}
.btn-primary:hover {
  border-color: var(--brand-dark);
  background: var(--brand-dark);
}
.btn-primary svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
}
button:disabled {
  cursor: default;
  opacity: 0.45;
}
.summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  padding: 20px 0;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
}
.metric {
  min-width: 0;
  padding: 0 var(--panel-padding);
  display: grid;
  grid-template-rows: 20px auto;
  gap: 8px;
}
.metric + .metric {
  border-left: 1px solid var(--line-soft);
}
.metric-label {
  color: #69768a;
  font-size: 12px;
  line-height: 20px;
}
.metric-value {
  display: block;
  margin: 0;
  color: #263348;
  font-size: 24px;
  line-height: 32px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.025em;
  white-space: nowrap;
}
.red,
.metric-value.red {
  color: var(--red);
}
.metric-value small {
  margin-left: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
}
.panel {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface);
}
.panel-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  min-height: 56px;
  padding: 0 var(--panel-padding);
  gap: var(--grid-gap);
  border-bottom: 1px solid var(--line);
}
.panel-title {
  display: flex;
  align-items: baseline;
  gap: 12px;
}
.panel-title strong {
  color: #29364b;
  font-size: 14px;
  font-weight: 650;
}
.panel-count {
  color: var(--muted);
  font-size: 12px;
}
.check-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  color: #4f5d71;
  font-size: 12px;
  cursor: pointer;
  user-select: none;
}
.check-control input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}
.check-box {
  display: grid;
  place-items: center;
  width: 16px;
  height: 16px;
  border: 1px solid #aeb9c8;
  border-radius: 2px;
  background: #fff;
}
.check-control input:checked + .check-box {
  border-color: var(--brand);
  background: var(--brand);
}
.check-control input:checked + .check-box::after {
  width: 7px;
  height: 4px;
  border-bottom: 1.5px solid #fff;
  border-left: 1.5px solid #fff;
  content: "";
  transform: rotate(-45deg) translate(1px, -1px);
}
.check-control input:focus-visible + .check-box {
  outline: 2px solid #83a8e8;
  outline-offset: 2px;
}
.table-scroll {
  overflow-x: auto;
  min-width: 0;
  overscroll-behavior-x: contain;
}
table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}
thead th {
  height: 40px;
  padding: 0 12px;
  border-bottom: 1px solid var(--line);
  background: #f6f8fa;
  color: #59677b;
  font-size: 12px;
  font-weight: 600;
  text-align: left;
  white-space: nowrap;
}
thead th.numeric {
  text-align: right;
}
tbody td {
  min-height: 64px;
  height: 64px;
  padding: 12px;
  border-bottom: 1px solid var(--line-soft);
  color: #445168;
  font-size: 12px;
  vertical-align: middle;
  overflow-wrap: anywhere;
}
thead th:first-child,
tbody td:first-child {
  padding-left: var(--panel-padding);
}
thead th:last-child,
tbody td:last-child {
  padding-right: var(--panel-padding);
}
tbody tr:last-child td {
  border-bottom: 0;
}
tbody tr:hover {
  background: #fafbfd;
}
.money-cell {
  color: #344158;
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}
.money-cell.receivable {
  color: var(--red);
  font-weight: 650;
}
.date-cell {
  color: #536176;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.row-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}
.management-page .local-preview-mode {
  flex-shrink: 0;
  font-size: 11px;
  white-space: nowrap;
}
.management-page .rds-readonly-notice {
  margin: 0 0 14px;
  padding: 8px 12px;
  border: 1px solid var(--border-color, #d6deea);
  border-radius: 4px;
  color: var(--text-secondary, #65748a);
  background: var(--surface, #fff);
  font-size: 12px;
  line-height: 1.6;
}
.row-actions.row-actions-vertical {
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  flex-wrap: nowrap;
  gap: 2px;
}
.row-actions.row-actions-grid {
  display: grid;
  grid-template-columns: repeat(3, 28px);
  grid-auto-rows: 28px;
  align-items: center;
  justify-content: start;
  justify-items: start;
  gap: 2px 4px;
  width: 92px;
}
.row-actions-grid.row-actions-grid-two-rows {
  grid-template-rows: repeat(2, 28px);
}
.row-actions-grid.row-actions-grid-single {
  grid-template-columns: 28px;
  width: 28px;
}
.row-actions-grid.row-actions-grid-four {
  grid-template-columns: repeat(4, 28px);
  width: 124px;
}
.row-actions-grid > .text-action {
  width: 28px;
  min-width: 0;
  min-height: 28px;
  padding: 0 2px;
  line-height: 20px;
}
.row-actions-grid > [data-action-slot="1"] {
  grid-area: 1 / 1;
}
.row-actions-grid > [data-action-slot="2"] {
  grid-area: 1 / 2;
}
.row-actions-grid > [data-action-slot="3"] {
  grid-area: 1 / 3;
}
.row-actions-grid > [data-action-slot="4"] {
  grid-area: 2 / 1;
}
.row-actions-grid > [data-action-slot="5"] {
  grid-area: 2 / 2;
}
.row-actions-grid > [data-action-slot="6"] {
  grid-area: 2 / 3;
}
.row-actions-grid-four > [data-action-slot="4"] {
  grid-area: 1 / 4;
}
:is(.row-actions-vertical, .row-actions-grid) > .text-action {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  text-align: left;
}
:is(.row-actions-vertical, .row-actions-grid) > .text-action,
:is(.row-actions-vertical, .row-actions-grid)
  > .text-action:is(:hover, :active, :focus, :focus-visible),
.plain-text-link,
.plain-text-link:is(:hover, :active, :focus, :focus-visible) {
  text-decoration: none;
}
:is(.row-actions-vertical, .row-actions-grid) > .text-action:focus-visible,
.plain-text-link:focus-visible {
  outline: 2px solid #83a8e8;
  outline-offset: 2px;
}
.text-action {
  min-height: 28px;
  padding: 0 4px;
  border: 0;
  background: transparent;
  color: var(--brand);
  font-size: 12px;
  white-space: nowrap;
}
.text-action:hover {
  color: var(--brand-dark);
}
.action-divider {
  height: 16px;
  border-left: 1px solid var(--line);
}
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 52px;
  padding: 0 var(--panel-padding);
  border-top: 1px solid var(--line);
  color: #788597;
  font-size: 12px;
}
.page-controls {
  display: flex;
  align-items: center;
  gap: 4px;
}
.page-ellipsis {
  flex: 0 0 16px;
  text-align: center;
  color: var(--muted);
}
.page-btn {
  display: grid;
  place-items: center;
  min-width: 28px;
  height: 28px;
  padding: 0 8px;
  border: 1px solid transparent;
  border-radius: 3px;
  background: #fff;
  color: #59677b;
  font-size: 12px;
}
.page-btn svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.page-btn:hover:not(:disabled) {
  border-color: var(--line);
  background: #f7f9fc;
}
.page-btn.active {
  border-color: #b8cbec;
  background: var(--brand-soft);
  color: var(--brand-dark);
  font-weight: 600;
}
.dialog-layer {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(24, 35, 52, 0.4);
}
.dialog-layer.open {
  display: flex;
}
.dialog {
  display: flex;
  flex-direction: column;
  width: min(1120px, calc(100vw - 48px));
  max-height: calc(100dvh - 48px);
  border: 1px solid #d5dce6;
  border-radius: 5px;
  background: #fff;
  box-shadow: var(--shadow-dialog);
  outline: none;
}
.dialog.dialog-narrow {
  width: min(880px, calc(100vw - 48px));
}
.dialog-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--grid-gap);
  flex: 0 0 auto;
  min-height: 64px;
  padding: 12px var(--panel-padding);
  border-bottom: 1px solid var(--line);
}
.dialog-head h2 {
  margin: 0;
  color: #26344a;
  font-size: 18px;
  line-height: 24px;
  font-weight: 650;
}
.icon-button {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 3px;
  background: transparent;
  color: #768397;
}
.icon-button:hover {
  border-color: var(--line);
  background: #f6f8fa;
  color: #39485f;
}
.icon-button svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.7;
  stroke-linecap: round;
}
.dialog-body {
  min-height: 0;
  overflow: auto;
  padding: var(--panel-padding);
}
.dialog-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  flex: 0 0 auto;
  min-height: 72px;
  padding: 16px var(--panel-padding);
  border-top: 1px solid var(--line);
  background: #fff;
}
#shared-confirm-layer .dialog-foot { flex-wrap: wrap; }
.info-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--grid-gap);
}
.info-item {
  min-width: 0;
  padding: 0;
}
.info-grid > .info-item:only-child {
  grid-column: 1 / -1;
}
.info-label {
  color: #7b8797;
  font-size: 11px;
  line-height: 20px;
}
.info-value {
  margin-top: 4px;
  color: #334158;
  font-size: 13px;
  font-weight: 550;
  overflow-wrap: anywhere;
  line-height: 20px;
}
.dialog-summary {
  display: grid;
  grid-template-columns: repeat(var(--summary-count, 3), minmax(180px, 1fr));
  grid-auto-flow: column;
  grid-auto-columns: minmax(180px, 1fr);
  margin: 24px 0;
  padding: 16px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
}
.dialog-summary-item {
  min-width: 0;
  padding: 0 16px;
  display: grid;
  grid-template-rows: 20px auto;
  gap: 8px;
}
.dialog-summary-item:first-child {
  padding-left: 0;
}
.dialog-summary-item:last-child {
  padding-right: 0;
}
.dialog-summary-item + .dialog-summary-item {
  border-left: 1px solid var(--line);
}
.dialog-summary-item span {
  color: #738095;
  font-size: 11px;
  line-height: 20px;
}
.dialog-summary-item strong {
  color: #334158;
  font-size: 18px;
  font-variant-numeric: tabular-nums;
  line-height: 24px;
  white-space: nowrap;
}
.dialog-summary-item strong.red {
  color: var(--red);
}
.tabs {
  display: flex;
  align-items: center;
  gap: 24px;
  min-height: 44px;
  border-bottom: 1px solid var(--line);
  margin-top: 24px;
}
.tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  height: 44px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #68758a;
  font-size: 13px;
  white-space: nowrap;
}
.tab.active {
  color: var(--brand-dark);
  font-weight: 600;
}
.tab.active::after {
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 2px;
  background: var(--brand);
  content: "";
}
.detail-scroll {
  margin-top: 12px;
}
.money-with-status {
  display: inline-grid;
  grid-template-columns: auto 48px;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}
.invoice-status {
  position: relative;
  overflow: hidden;
  height: 20px;
  padding: 0;
  border: 1px solid #d3dae2;
  border-radius: 2px;
  background: #f7f8fa;
  color: #697483;
  font-size: 10px;
  line-height: 18px;
  text-align: center;
  white-space: nowrap;
}
.invoice-status.full {
  border-color: #c5dace;
  background: #f4faf6;
  color: #38764f;
}
.invoice-status {
  text-decoration: none;
}
.invoice-status.output-mismatch {
  border-color: #efcfcd;
  background: var(--red-soft);
  color: var(--red);
}
.invoice-status.partial,
.invoice-status.over {
  border-color: #dfcaa7;
  background: #fff8eb;
  color: #8b612a;
}
.invoice-status.partial::after,
.invoice-status.over::after,
.invoice-status.output-mismatch::after {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(
    110deg,
    transparent 20%,
    rgba(255, 255, 255, 0.85) 50%,
    transparent 80%
  );
  content: "";
  animation: invoice-status-sweep 3.6s ease-in-out infinite;
}
.invoice-status:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}
.detail-scroll:has(.money-with-status) .detail-table {
  min-width: 940px;
}
@keyframes invoice-status-sweep {
  0%,
  55% {
    transform: translateX(-160%);
  }
  80%,
  100% {
    transform: translateX(160%);
  }
}
@media (prefers-reduced-motion: reduce) {
  .invoice-status::after {
    animation: none;
    display: none;
  }
}
.detail-table {
  border: 1px solid var(--line);
  min-width: 640px;
}
.detail-table.detail-table-wide {
  min-width: 900px;
}
.detail-table thead th {
  height: 36px;
  font-size: 11px;
}
.detail-table tbody td {
  height: 44px;
  padding-block: 12px;
  font-size: 12px;
}
.detail-table th,
.detail-table td {
  padding-inline: 12px;
}
.tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 8px;
  border: 1px solid #cfd8e5;
  border-radius: 3px;
  background: #fff;
  color: #5e6d81;
  font-size: 11px;
  line-height: 18px;
  white-space: nowrap;
}
.tag.success {
  border-color: #b8d7c5;
  color: var(--green);
  background: #fbfefc;
}
.tag.warning {
  border-color: #efd8a8;
  color: var(--amber);
  background: #fffdfa;
}
.tag.info {
  border-color: #c4d4ef;
  color: var(--brand-dark);
  background: #fbfcff;
}
.detail-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 24px;
  margin: 24px 0 12px;
  color: #334158;
  font-size: 13px;
  font-weight: 650;
  gap: var(--grid-gap);
}
.detail-section-title:first-child {
  margin-top: 0;
}
.table-empty {
  padding: 40px 16px;
  color: #8792a1;
  font-size: 12px;
  text-align: center;
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--grid-gap);
}
.project-basics > :first-child {
  grid-column: span 2;
}
.form-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}
.form-label {
  color: #4e5b70;
  font-size: 12px;
  line-height: 20px;
  font-weight: 550;
}
.form-control {
  width: 100%;
  height: var(--control-height);
  padding: 0 12px;
  border: 1px solid #cdd5e0;
  border-radius: 3px;
  background: #fff;
  color: #344158;
  font-size: 13px;
}
.form-control:disabled {
  background: #f7f8fa;
  color: #667182;
}
.required {
  color: var(--red);
}
#create-form {
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.registration-heading {
  margin-bottom: 0;
}
.registration-rows {
  display: grid;
  gap: 0;
}
.registration-row {
  margin: 0;
  padding: 20px 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  min-width: 0;
}
.registration-row:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}
.registration-row-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 24px;
  margin-bottom: 12px;
}
.registration-row-head strong {
  font-size: 12px;
  font-weight: 600;
}
.registration-fields {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--grid-gap);
}
.money-input {
  position: relative;
}
.money-input > span {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 13px;
}
.money-input input {
  padding-left: 28px;
  font-variant-numeric: tabular-nums;
}
.form-error {
  margin-top: 16px;
  padding: 12px;
  border: 1px solid #efcfcd;
  background: var(--red-soft);
  color: var(--red);
  font-size: 12px;
  line-height: 20px;
}
.party-stack {
  display: grid;
  gap: 4px;
  line-height: 20px;
}
.party-stack span {
  overflow-wrap: anywhere;
}
.project-name {
  display: block;
  max-width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: #2d3a50;
  font-size: 13px;
  font-weight: 600;
  text-align: left;
  line-height: 20px;
  overflow-wrap: anywhere;
}
.project-name:hover {
  color: var(--brand);
}
.project-companies {
  margin-top: 4px;
  color: #7e8a9b;
  font-size: 11px;
  line-height: 20px;
  overflow-wrap: anywhere;
}
.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 60;
  display: none;
  min-width: 180px;
  padding: 12px 16px;
  border: 1px solid #b9d8c5;
  border-radius: 4px;
  background: #fff;
  box-shadow: 0 4px 18px rgba(19, 39, 65, 0.13);
  color: var(--green);
  font-size: 12px;
}
.toast.show {
  display: block;
}
@media (max-width: 1180px) {
  :root {
    --sidebar-width: 190px;
  }
  .metric-value {
    font-size: 20px;
  }
  .brand {
    padding-inline: 16px;
  }
}
@media (max-width: 760px) {
  :root {
    --sidebar-width: 68px;
    --topbar-height: 64px;
    --panel-padding: 16px;
    --section-gap: 16px;
  }
  .brand {
    justify-content: center;
    padding: 0;
  }
  .brand-lockup {
    width: 60px;
  }
  .brand-logo {
    width: 60px;
    height: auto;
  }
  .brand-name,
  .nav-label,
  .nav-item > span:not(.nav-icon):not(.nav-secret) {
    display: none;
  }
  .nav-scroll {
    padding: 16px 8px;
  }
  .nav-scroll::after {
    margin: 16px -8px -16px;
  }
  .nav-item {
    padding: 0;
    justify-content: center;
  }
  .nav-secret {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 14px;
    height: 14px;
    font-size: 9px;
  }
  .top-user .avatar,
  .breadcrumb > span:not(.breadcrumb-current) {
    display: none;
  }
  .topbar {
    padding-inline: 16px;
  }
  .topbar-right {
    font-size: 11px;
  }
  .main {
    padding: 16px;
  }
  .summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 0;
  }
  .metric {
    padding: 16px;
    border-bottom: 1px solid var(--line);
  }
  .metric:nth-child(2n + 1) {
    border-left: 0;
  }
  .metric:nth-last-child(-n + 2) {
    border-bottom: 0;
  }
  .metric-value {
    font-size: 18px;
    line-height: 28px;
  }
  .panel-heading {
    gap: 8px;
  }
  .panel-title {
    gap: 8px;
  }
  .panel-title .panel-count {
    display: none;
  }
  .dialog-layer {
    padding: 12px;
  }
  .dialog,
  .dialog.dialog-narrow {
    width: calc(100vw - 24px);
    max-height: calc(100dvh - 24px);
  }
  .dialog-head {
    min-height: 60px;
  }
  .dialog-head h2 {
    font-size: 16px;
  }
  .info-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .form-grid,
  .registration-fields {
    grid-template-columns: 1fr;
  }
  .project-basics > :first-child {
    grid-column: auto;
  }
  .tabs {
    gap: 16px;
    overflow-x: auto;
  }
  .pagination {
    flex-wrap: wrap;
    gap: 8px;
  }
  .pagination .page-controls {
    margin-left: auto;
    gap: 2px;
  }
  .pagination .page-btn {
    min-width: 24px;
    padding-inline: 2px;
  }
  .pagination .page-ellipsis {
    flex-basis: 12px;
  }
  .btn {
    padding-inline: 12px;
  }
  .dialog-summary {
    grid-template-columns: repeat(var(--summary-count, 3), minmax(160px, 1fr));
    grid-auto-columns: minmax(160px, 1fr);
  }
}
@media (max-width: 440px) {
  .summary {
    grid-template-columns: 1fr;
  }
  .metric + .metric {
    border-left: 0;
  }
  .metric:nth-last-child(2) {
    border-bottom: 1px solid var(--line);
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation: none !important;
    transition: none !important;
  }
}
[hidden] {
  display: none !important;
}
/* 新开发页面复用的表单与本地身份入口。 */
.local-user {
  width: 130px;
}
.login-users {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.login-users .btn {
  height: 48px;
}
.password-auth .dialog {
  width: min(440px, calc(100vw - 48px));
}
.password-auth .dialog-foot {
  display: none;
}
#password-login-form {
  display: grid;
  gap: 20px;
}
#password-login-form .btn {
  justify-self: end;
}
.form-grid {
  align-items: start;
}
.form-field {
  min-width: 0;
}
.btn-danger {
  color: var(--red);
  border-color: #e7babd;
}
.action-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.dialog .form-error {
  margin-top: 16px;
}
@media (max-width: 650px) {
  .local-user {
    width: 100px;
  }
  .breadcrumb {
    font-size: 11px;
  }
}
/* 当前管理页统一金额网格和弹窗滚动；不作用于报价/合同模板。 */
.management-page .dialog-summary {
  grid-template-columns: repeat(
    var(--summary-count, 3),
    minmax(max-content, 1fr)
  );
  grid-auto-columns: minmax(max-content, 1fr);
}
.management-page .dialog-summary-item {
  min-width: 160px;
}
.management-page .dialog > form {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}
.management-page .dialog > form > .dialog-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}
.management-page .invoice-status {
  min-width: 48px;
  flex-shrink: 0;
}
.management-page .receipt-status.over {
  color: var(--red);
  border-color: #efcfcd;
  background: var(--red-soft);
}
.management-page .amount-history-section {
  margin-top: 24px;
}
.management-page .source-details {
  margin-block: 12px;
  border-top: 1px solid var(--line-soft);
}
.management-page .source-details > summary {
  padding-block: 10px;
  color: var(--subtext);
  font-size: 12px;
  cursor: pointer;
}
.management-page .source-details > summary:focus-visible {
  outline: 2px solid #83a8e8;
  outline-offset: 2px;
}
.management-page .source-details-body {
  padding: 4px 0 12px;
}
.management-page .amount-history-section > h3 {
  margin: 0 0 12px;
  font-size: 14px;
}
.management-page .amount-history-section .detail-table {
  width: 100%;
  min-width: 480px;
  table-layout: fixed;
}
.management-page .amount-history-section .detail-table td:last-child {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.management-page .amount-history-section .table-empty {
  min-height: 64px;
  padding: 16px;
}

.management-page .management-request-status {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 2500;
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: min(560px, calc(100vw - 40px));
  padding: 10px 14px;
  border: 1px solid #d9e2f0;
  border-radius: 6px;
  background: #fff;
  color: #42536f;
  box-shadow: 0 4px 16px #102d5020;
  font-size: 13px;
}
.management-page .management-request-status[hidden] {
  display: none;
}
.management-page .dialog-body > .management-request-status {
  position: static;
  margin-top: 16px;
  max-width: 100%;
  box-shadow: none;
}
.management-page .management-request-status .btn {
  flex-shrink: 0;
}
/* 2.0 人工台账：跨页面复用原有表格、表单和弹窗。 */
.manual-ledger-section { margin-top: 20px; }
.manual-ledger-head { display: flex; align-items: center; gap: 10px; margin: 12px 0; flex-wrap: wrap; }
.manual-ledger-head h3 { margin: 0; font-size: 14px; }
.manual-ledger-actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin: 10px 0; }
.manual-ledger-head .manual-ledger-actions { margin: 0 0 0 auto; }
.manual-ledger-note { color: var(--text-secondary, #64748b); margin: 8px 0 14px; font-size: 13px; }
.manual-ledger-dialog { width: min(1100px, calc(100vw - 48px)); }
.manual-ledger-dialog .form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.manual-allocation-row { display: grid; grid-template-columns: minmax(100px, 1fr) minmax(220px, 2fr) minmax(100px, 1fr) minmax(100px, 1fr) auto; align-items: end; gap: 10px; margin: 10px 0; }
.manual-allocation-row .text-action { align-self: center; }
.manual-allocation-amount { display: inline-block; margin-left: 10px; font-variant-numeric: tabular-nums; }
.manual-ledger-section .text-action + .text-action, .manual-workspace .text-action + .text-action { margin-left: 10px; }
@media (max-width: 700px) {
  .manual-ledger-dialog .form-grid, .manual-allocation-row { grid-template-columns: minmax(0, 1fr); }
  .manual-ledger-head .manual-ledger-actions { margin-left: 0; width: 100%; }
}
