:root {
  color-scheme: light;
  --ui-bg: #f6f7f9;
  --ui-surface: #ffffff;
  --ui-surface-soft: #f9fafb;
  --ui-line: #e5e7eb;
  --ui-line-strong: #d1d5db;
  --ui-text: #111827;
  --ui-muted: #6b7280;
  --ui-weak: #9ca3af;
  --ui-primary: #2563eb;
  --ui-primary-soft: #eff6ff;
  --ui-accent: #0f766e;
  --ui-accent-soft: #ecfdf5;
  --ui-warning: #b45309;
  --ui-warning-soft: #fff7ed;
  --ui-danger: #dc2626;
  --ui-danger-soft: #fef2f2;
  --ui-success: #15803d;
  --ui-success-soft: #f0fdf4;
  --ui-radius: 8px;
  --ui-shadow: 0 1px 2px rgba(15, 23, 42, .06);
  --bg: var(--ui-bg);
  --panel: var(--ui-surface);
  --panel-strong: var(--ui-surface);
  --panel-soft: var(--ui-surface-soft);
  --line: var(--ui-line);
  --line-strong: var(--ui-line-strong);
  --text: var(--ui-text);
  --muted: var(--ui-muted);
  --subtle: var(--ui-muted);
  --primary: var(--ui-primary);
  --primary-hover: #1d4ed8;
  --primary-weak: var(--ui-primary-soft);
  --danger: var(--ui-danger);
  --ok: var(--ui-success);
  --warn: var(--ui-warning);
  --orange: var(--ui-warning);
  --focus: 0 0 0 3px rgba(37, 99, 235, .18);
}

html,
body {
  background: var(--ui-bg);
  color: var(--ui-text);
}

body {
  grid-template-columns: 248px minmax(0, 1fr);
  font-family: Inter, "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  letter-spacing: 0;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 11px;
  border: 1px solid var(--ui-line-strong);
  border-radius: var(--ui-radius);
  color: #374151;
  background: #fff;
  font-weight: 700;
  box-shadow: none;
}

button:hover {
  border-color: #93c5fd;
  background: #f8fbff;
}

button.primary {
  color: #fff;
  background: var(--ui-primary);
  border-color: var(--ui-primary);
  box-shadow: none;
}

button.primary:hover {
  background: #1d4ed8;
  border-color: #1d4ed8;
}

button.ghost {
  background: #fff;
}

button.danger,
.danger button {
  color: var(--ui-danger);
  background: var(--ui-danger-soft);
  border-color: #fecaca;
}

button:disabled {
  cursor: not-allowed;
  opacity: .55;
  transform: none;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
.file-chip:focus-visible,
.button-link:focus-visible {
  outline: 2px solid rgba(37, 99, 235, .45);
  outline-offset: 2px;
  box-shadow: none;
  border-color: var(--ui-primary);
}

input,
select,
textarea {
  width: 100%;
  min-height: 34px;
  padding: 7px 10px;
  border: 1px solid var(--ui-line-strong);
  border-radius: var(--ui-radius);
  color: var(--ui-text);
  background: #fff;
  box-shadow: none;
}

textarea {
  min-height: 74px;
  resize: vertical;
}

.sidebar {
  width: 248px;
  padding: 18px 14px;
  gap: 16px;
  background: #fff;
  border-right: 1px solid var(--ui-line);
  box-shadow: none;
  color-scheme: light;
}

.brand {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-height: 44px;
  padding: 4px 6px;
  border: 0;
  background: transparent;
}

.brand::before {
  content: "OA";
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: #fff;
  background: linear-gradient(135deg, var(--ui-primary), var(--ui-accent));
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0;
  box-shadow: 0 10px 22px rgba(37, 99, 235, .16);
}

.brand strong {
  color: var(--ui-text);
  font-size: 16px;
  line-height: 1.25;
  min-width: 0;
}

.brand span {
  margin-top: 4px;
  color: var(--ui-muted);
  font-size: 12px;
  min-width: 0;
}

#nav,
.nav-group {
  display: grid;
  gap: 4px;
}

.nav-group + .nav-group {
  margin-top: 8px;
}

.nav-group-title,
.nav-label {
  padding: 8px 10px 4px;
  color: var(--ui-weak);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
}

#nav button {
  width: 100%;
  min-height: 36px;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  justify-content: stretch;
  padding: 7px 10px;
  border: 1px solid transparent;
  border-radius: var(--ui-radius);
  color: #374151;
  background: transparent;
  text-align: left;
  font-weight: 700;
  box-shadow: none;
}

#nav button:hover {
  background: var(--ui-surface-soft);
}

#nav button.active {
  color: var(--ui-primary);
  background: var(--ui-primary-soft);
  border-color: #bfdbfe;
}

.nav-icon {
  width: 22px;
  height: 22px;
  padding: 3px;
  border-radius: 6px;
  background: rgba(17, 24, 39, .04);
}

.sidebar-tools {
  margin-top: auto;
  display: grid;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--ui-line);
}

.main {
  min-width: 0;
  display: grid;
  grid-template-rows: auto 1fr;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  min-height: 64px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 12px 24px;
  background: rgba(255, 255, 255, .94);
  border-bottom: 1px solid var(--ui-line);
  box-shadow: none;
  backdrop-filter: blur(12px);
}

.topbar h1 {
  margin: 0;
  font-size: 20px;
  line-height: 1.3;
}

.topbar p {
  margin: 2px 0 0;
  color: var(--ui-muted);
  font-size: 12px;
}

#view {
  min-width: 0;
  padding: 18px 24px 28px;
}

.page-stack {
  display: grid;
  gap: 14px;
  align-content: start;
}

.page-hero {
  min-height: 104px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 16px;
  border: 1px solid var(--ui-line);
  border-radius: var(--ui-radius);
  background: #fff;
  box-shadow: var(--ui-shadow);
}

.hero-copy {
  min-width: 0;
}

.hero-copy h2,
.project-header h2 {
  margin: 8px 0 5px;
  color: var(--ui-text);
  font-size: 20px;
  line-height: 1.3;
  letter-spacing: 0;
}

.hero-copy p,
.project-header p {
  margin: 0;
  color: var(--ui-muted);
  font-size: 13px;
}

.hero-actions,
.top-actions,
.detail-section-actions,
.inline-section-actions,
.filters,
.toolbar,
.library-head-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.surface-section,
.detail-section,
.row-card,
.empty,
.table-shell,
.upload-box,
.contract-file-panel,
.file-chip,
.project-header {
  border: 1px solid var(--ui-line);
  border-radius: var(--ui-radius);
  background: var(--ui-surface);
  box-shadow: var(--ui-shadow);
}

.surface-section,
.detail-section {
  overflow: hidden;
}

.surface-head,
.detail-section-head {
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--ui-line);
  background: var(--ui-surface-soft);
}

.surface-head h3,
.detail-section-head h3 {
  margin: 0;
  color: var(--ui-text);
  font-size: 16px;
  line-height: 1.35;
}

.surface-body,
.detail-section-body {
  padding: 14px;
}

.grid {
  display: grid;
  gap: 12px;
}

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

.cols-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.cols-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.detail-grid,
.business-detail-grid {
  align-items: stretch;
}

.detail-grid > .detail-section,
.business-detail-grid > .detail-section {
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: 100%;
}

.detail-stack {
  display: grid;
  gap: 12px;
}

.metric {
  min-height: 78px;
  display: grid;
  align-content: center;
  gap: 3px;
  padding: 12px;
  border: 1px solid var(--ui-line);
  border-radius: var(--ui-radius);
  background: #fff;
  box-shadow: none;
}

.metric span {
  color: var(--ui-muted);
  font-size: 12px;
  font-weight: 700;
}

.metric strong {
  color: var(--ui-text);
  font-size: 22px;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.detail-meta,
.project-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}

.tag,
.status-pill {
  min-height: 22px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border: 1px solid var(--ui-line);
  border-radius: 999px;
  color: #374151;
  background: #fff;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
  white-space: nowrap;
}

.tag.blue,
.tag.primary,
.status-pill.blue {
  color: var(--ui-primary);
  background: var(--ui-primary-soft);
  border-color: #bfdbfe;
}

.tag.green,
.tag.success,
.status-pill.paid,
.status-pill.success {
  color: var(--ui-success);
  background: var(--ui-success-soft);
  border-color: #bbf7d0;
}

.tag.orange,
.tag.warning,
.status-pill.partial {
  color: var(--ui-warning);
  background: var(--ui-warning-soft);
  border-color: #fed7aa;
}

.tag.red,
.tag.danger,
.status-pill.unpaid {
  color: var(--ui-danger);
  background: var(--ui-danger-soft);
  border-color: #fecaca;
}

.tabs {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tabs button,
.tab {
  min-height: 34px;
  padding: 7px 11px;
  border: 1px solid transparent;
  border-radius: var(--ui-radius);
  color: #4b5563;
  background: transparent;
  font-weight: 800;
}

.tabs button.active,
.tab.active {
  color: var(--ui-primary);
  background: var(--ui-primary-soft);
  border-color: #bfdbfe;
}

.table-shell,
.table-wrap {
  width: 100%;
  overflow: auto;
  box-shadow: none;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
  font-size: 13px;
}

th,
td {
  height: 42px;
  padding: 9px 12px;
  border-bottom: 1px solid var(--ui-line);
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}

th {
  color: var(--ui-muted);
  background: #fbfbfc;
  font-size: 12px;
  font-weight: 800;
}

td.money,
th.money {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

tbody tr:hover td {
  background: #f8fafc;
}

.row-card {
  min-height: 58px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  box-shadow: none;
}

.row-card > div {
  min-width: 0;
}

.row-card strong {
  display: block;
  color: var(--ui-text);
  line-height: 1.35;
}

.row-card p,
.muted,
.section-hint,
.hint {
  color: var(--ui-muted);
  font-size: 12px;
}

.row-card.clickable:hover {
  border-color: #bfdbfe;
  background: #f8fbff;
}

.field {
  display: grid;
  gap: 5px;
}

.field span,
.field label {
  color: var(--ui-muted);
  font-size: 12px;
  font-weight: 800;
}

.empty {
  min-height: 96px;
  display: grid;
  place-items: center;
  padding: 18px;
  color: var(--ui-muted);
  text-align: center;
  box-shadow: none;
}

.project-summary-strip,
.summary-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--ui-line);
  border-radius: var(--ui-radius);
  background: var(--ui-line);
}

.project-summary-chip,
.summary-strip div {
  min-height: 58px;
  display: grid;
  align-content: center;
  gap: 2px;
  padding: 9px 10px;
  background: var(--ui-surface-soft);
}

.project-summary-chip span,
.summary-strip span {
  color: var(--ui-muted);
  font-size: 12px;
}

.project-summary-chip strong,
.summary-strip strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auto-status-panel {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 9px;
  border: 1px solid var(--ui-line);
  border-radius: var(--ui-radius);
  background: var(--ui-surface-soft);
  color: var(--ui-muted);
  font-size: 12px;
}

.upload-box,
.contract-file-list-box,
.upload-dropzone,
.upload-picker {
  border-color: var(--ui-line);
  border-radius: var(--ui-radius);
  background: var(--ui-surface-soft);
}

.upload-progress {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #e5e7eb;
}

.upload-progress-bar {
  background: linear-gradient(90deg, var(--ui-primary), var(--ui-accent));
}

.file-chip {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  box-shadow: none;
}

dialog::backdrop {
  background: rgba(15, 23, 42, .38);
  backdrop-filter: blur(8px);
}

dialog .modal,
.modal {
  border-radius: var(--ui-radius);
  border: 1px solid var(--ui-line);
  background: #fff;
  box-shadow: 0 24px 80px rgba(15, 23, 42, .18);
}

.modal header,
.modal footer {
  min-height: 56px;
  padding: 12px 14px;
  border-color: var(--ui-line);
}

.avatar-btn {
  width: 36px;
  min-width: 36px;
  height: 36px;
  min-height: 36px;
  padding: 0;
  border-radius: 999px;
  color: #fff;
  background: #111827;
  border-color: #111827;
  font-weight: 800;
}

.avatar-dropdown {
  border: 1px solid var(--ui-line);
  border-radius: var(--ui-radius);
  background: #fff;
  box-shadow: 0 18px 60px rgba(15, 23, 42, .14);
}

.icon-btn {
  width: 36px;
  min-width: 36px;
  padding: 0;
}

.file-remove-btn,
.actual-voucher-remove {
  width: 24px;
  min-width: 24px;
  height: 24px;
  min-height: 24px;
  padding: 0;
}

/* Phase 2 deep UI redesign: structural density and component consolidation */
.project-tabs-shell,
.detail-pane-toolbar,
.surface-toolbar {
  border: 1px solid var(--ui-line);
  border-radius: var(--ui-radius);
  background: #fff;
  box-shadow: var(--ui-shadow);
}

.project-tabs-shell {
  padding: 6px;
}

.project-tabs-shell .tabs {
  gap: 4px;
}

.project-tabs-shell .tabs button {
  flex: 0 0 auto;
  min-height: 32px;
  padding: 6px 10px;
}

.detail-pane,
.detail-pane-stack {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.detail-pane-toolbar,
.surface-toolbar {
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
}

.detail-pane-toolbar h3,
.surface-toolbar h3 {
  margin: 0;
  color: var(--ui-text);
  font-size: 14px;
  line-height: 1.3;
}

.surface-head,
.detail-section-head {
  min-height: 40px !important;
  align-items: center;
  padding: 6px 10px !important;
}

details > summary.surface-head {
  cursor: pointer;
  list-style: none;
}

details > summary.surface-head::-webkit-details-marker {
  display: none;
}

.surface-head h3,
.detail-section-head h3 {
  font-size: 14px;
  line-height: 1.25;
}

.surface-head .muted,
.detail-section-head .muted {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  line-height: 1.25;
}

.detail-section-head .detail-section-actions {
  flex-wrap: nowrap;
  gap: 6px;
}

.detail-section-head button,
.surface-head button {
  min-height: 28px !important;
  padding: 4px 8px !important;
}

.detail-section-head .detail-section-actions button,
.detail-section-head .detail-section-actions button.primary {
  min-height: 28px !important;
  padding: 4px 8px !important;
  box-shadow: none;
}

.surface-body,
.detail-section-body {
  padding: 10px;
}

.detail-grid {
  gap: 10px;
}

.detail-grid > .detail-section,
.business-detail-grid > .detail-section {
  min-height: 0;
  box-shadow: none;
}

.detail-grid > .detail-section > .detail-section-head,
.business-detail-grid > .detail-section > .detail-section-head {
  height: auto !important;
  min-height: 40px !important;
  padding: 6px 10px !important;
}

.detail-section .detail-section .detail-section-head {
  min-height: 40px;
  background: #fff;
}

.detail-section .detail-section .detail-section-body {
  background: #fff;
}

.metric {
  min-height: 62px;
  padding: 9px 10px;
}

.metric strong {
  font-size: 18px;
}

.filters,
.payable-filters {
  gap: 6px;
}

.surface-toolbar .filters,
.payable-filters {
  flex: 1 1 auto;
  min-width: 0;
}

.payable-toolbar {
  margin-bottom: 8px;
  box-shadow: none;
}

.payable-filters > select,
.payable-filters > input {
  flex: 1 1 150px;
  min-width: 0;
}

.filter-summary {
  margin: 0 0 8px;
}

.table-shell,
.table-wrap {
  border: 1px solid var(--ui-line);
  border-radius: var(--ui-radius);
  background: #fff;
  box-shadow: none;
}

.surface-body > table {
  display: block;
  overflow: auto;
  border: 1px solid var(--ui-line);
  border-radius: var(--ui-radius);
  background: #fff;
}

table {
  border-collapse: separate;
  border-spacing: 0;
  min-width: 900px;
  font-size: 13px;
}

th,
td {
  height: 38px;
  padding: 7px 10px;
  border-right: 1px solid var(--ui-line);
  border-bottom: 1px solid var(--ui-line);
  white-space: nowrap;
}

th:last-child,
td:last-child {
  border-right: 0;
}

tbody tr:last-child td {
  border-bottom: 0;
}

th {
  height: 36px;
  color: #4b5563;
  background: #f8fafc;
  font-size: 12px;
  letter-spacing: 0;
}

td {
  vertical-align: middle;
}

td .muted,
td p {
  white-space: normal;
}

td .stack-sm,
td .row-actions,
td .detail-actions {
  gap: 5px;
}

td button,
td input,
td select {
  min-height: 30px;
  padding-top: 5px;
  padding-bottom: 5px;
}

.compact-table th,
.compact-table td {
  height: 36px;
  padding: 6px 9px;
}

.project-table-shell table {
  min-width: 980px;
}

.project-table-shell th {
  height: 36px;
  padding: 6px 9px;
}

.project-table-shell td {
  height: 48px;
  padding: 8px 9px;
}

.project-table-shell tr:hover td {
  background: #f8fbff;
}

.project-cell-main {
  display: grid;
  gap: 2px;
}

.project-cell-main strong,
.project-address-cell {
  overflow: hidden;
  text-overflow: ellipsis;
}

.project-cell-main span,
.project-people-cell span {
  color: var(--ui-muted);
  font-size: 12px;
}

.project-people-cell {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
}

.project-people-cell span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-status-cell {
  display: flex;
  align-items: center;
}

.project-th-wrap {
  min-height: 28px;
  gap: 4px;
}

.table-head-icon {
  width: 28px;
  min-width: 28px;
  height: 28px;
  min-height: 28px;
  padding: 0;
  font-size: 12px;
}

.contract-file-panel,
.upload-box,
.upload-dropzone,
.upload-picker,
.contract-file-list-box {
  box-shadow: none;
}

.contract-file-panel {
  padding: 8px;
}

.upload-box,
.upload-dropzone,
.upload-picker {
  min-height: 76px;
  padding: 10px;
}

.contract-file-list-box {
  min-height: 42px;
  padding: 8px;
}

.file-chip {
  min-height: 26px;
  padding: 3px 7px;
}

td .file-list {
  display: flex;
  flex-wrap: nowrap;
  gap: 4px;
}

td .file-chip {
  max-width: 128px;
}

td .file-chip > span:not(.file-icon) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.payable-table-shell table {
  min-width: 1180px;
}

.payroll-page .table-shell table {
  min-width: 1120px;
}

.payroll-page td {
  vertical-align: top;
}

.payroll-page .compact-list,
.payroll-page .list {
  display: grid;
  gap: 6px;
}

.payroll-page .row-card {
  min-height: 44px;
  padding: 7px 8px;
  gap: 8px;
}

.payroll-page .row-card p {
  margin: 2px 0;
}

.payroll-page td .empty {
  min-height: 32px;
  padding: 5px 8px;
  place-items: center start;
  text-align: left;
}

.payroll-page td .muted {
  margin-top: 3px;
  line-height: 1.25;
}

.payroll-page td input {
  min-width: 92px;
}

.settings-page .surface-section,
.permissions-page .surface-section,
.accounts-page .surface-section,
.people-page .surface-section,
.finance-page .surface-section,
.payroll-page .surface-section {
  box-shadow: none;
}

.settings-page .surface-head,
.permissions-page .surface-head,
.accounts-page .surface-head,
.people-page .surface-head,
.finance-page .surface-head,
.payroll-page .surface-head {
  min-height: 44px;
}

.settings-page .danger,
.danger-zone,
.restore-zone {
  border-color: #fecaca;
  background: #fff7f7;
}

@media (max-width: 1100px) {
  body {
    grid-template-columns: 72px minmax(0, 1fr);
  }

  .sidebar {
    width: 72px;
    padding: 14px 10px;
  }

  .brand strong,
  .brand span,
  .nav-group-title,
  .nav-label,
  #nav button span,
  .sidebar-tools {
    display: none;
  }

  #nav button {
    grid-template-columns: 1fr;
    justify-items: center;
    padding: 8px;
  }

  .brand {
    grid-template-columns: 1fr;
    justify-items: center;
  }

  .cols-2,
  .cols-3,
  .cols-4 {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 720px) {
  body {
    display: block;
  }

  .sidebar {
    position: static;
    width: 100%;
    height: auto;
    display: block;
    padding: 10px;
    border-right: 0;
    border-bottom: 1px solid var(--ui-line);
  }

  .brand strong,
  .brand span {
    display: block;
  }

  .brand {
    grid-template-columns: 42px minmax(0, 1fr);
    justify-items: stretch;
  }

  #nav {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-top: 10px;
  }

  .nav-group {
    display: contents;
  }

  .nav-group-title,
  .nav-label {
    display: none;
  }

  #nav button {
    min-height: 40px;
  }

  .topbar {
    grid-template-columns: 1fr;
    padding: 12px 14px;
  }

  #view {
    padding: 14px;
  }

  .page-hero {
    grid-template-columns: 1fr;
  }

  .hero-actions,
  .detail-section-actions,
  .filters,
  .toolbar,
  .library-head-filters {
    align-items: stretch;
  }

  .hero-actions > *,
  .detail-section-actions > *,
  .filters > *,
  .toolbar > *,
  .library-head-filters > * {
    flex: 1 1 160px;
  }

  .row-card {
    grid-template-columns: 1fr;
  }

  .project-summary-strip,
  .summary-strip {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .surface-head,
  .detail-section-head {
    min-height: 40px !important;
    display: flex !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    padding: 6px 8px !important;
  }

  .surface-head > *,
  .detail-section-head > * {
    min-width: 0;
  }

  .surface-head > div,
  .detail-section-head > div {
    display: flex;
    align-items: center;
    gap: 6px;
  }

  .surface-head h3,
  .detail-section-head h3 {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .surface-head button,
  .detail-section-head button,
  .surface-head .tag,
  .detail-section-head .tag {
    flex: 0 0 auto !important;
    white-space: nowrap;
  }

  .surface-head .muted,
  .detail-section-head .muted {
    display: inline;
    margin-top: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .project-tabs-shell .tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
  }

  .finance-page .surface-head {
    height: 44px !important;
    max-height: 44px;
    overflow: visible;
  }

  .finance-page .surface-head .muted,
  .finance-page .surface-head .detail-meta {
    display: none;
  }

  .finance-page .collapse-section > summary.surface-head::after {
    min-height: 26px;
    padding: 3px 8px;
  }

  .payroll-page .surface-head {
    height: 44px !important;
    max-height: 44px;
  }

  .payroll-page .surface-head .muted {
    display: none;
  }

  .payroll-page .collapse-section > summary.surface-head::after {
    min-height: 26px;
    padding: 3px 8px;
  }
}
