:root {
  color-scheme: light;
  --bg: #eef4ed;
  --bg-soft: #f7f9f3;
  --panel: #ffffff;
  --panel-muted: #fbfcf8;
  --border: #d8e0d5;
  --border-strong: #bccab8;
  --text: #14241b;
  --muted: #637066;
  --primary: #1f5b3d;
  --primary-dark: #143725;
  --primary-soft: #e6f1e9;
  --gold: #d99128;
  --gold-soft: #fff4d8;
  --blue: #1d6fd1;
  --danger: #b42318;
  --danger-soft: #fff1ee;
  --success-bg: #e4f4e9;
  --success-text: #17633a;
  --error-bg: #fdecec;
  --error-text: #a11a1a;
  --warning-bg: #fff6da;
  --warning-text: #805200;
  --shadow: 0 18px 42px rgba(31, 58, 41, 0.08);
  --sidebar-width: 256px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(180deg, rgba(31, 91, 61, 0.10) 0, rgba(31, 91, 61, 0) 240px),
    repeating-linear-gradient(90deg, rgba(31, 91, 61, 0.035) 0, rgba(31, 91, 61, 0.035) 1px, transparent 1px, transparent 36px),
    var(--bg);
  color: var(--text);
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", Tahoma, sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  text-decoration: none;
}

.topbar {
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 10px 28px;
  background:
    linear-gradient(90deg, #143725 0%, #1f5b3d 58%, #25573f 100%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 12px 28px rgba(20, 55, 37, 0.18);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 238px;
  color: #fff;
}

.brand:hover {
  color: #fff;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 8px;
  background: linear-gradient(135deg, #fff8dd 0%, #efc55d 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.42), 0 10px 22px rgba(16, 43, 29, 0.28);
}

.brand-mark img {
  width: 32px;
  height: 32px;
  display: block;
}

.brand-copy {
  display: grid;
  gap: 1px;
}

.brand-copy strong {
  color: #fff;
  font-size: 17px;
  font-weight: 800;
  line-height: 1.15;
}

.brand-copy span {
  color: rgba(255, 255, 255, 0.70);
  font-size: 12px;
}

.nav {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1 1 auto;
  flex-wrap: wrap;
  gap: 6px;
}

.nav-link {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  padding: 7px 12px;
  border: 1px solid transparent;
  border-radius: 6px;
  color: rgba(255, 255, 255, 0.78);
  font-weight: 700;
}

.nav-link:hover,
.nav-link.active {
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.14);
}

.nav-link.active {
  box-shadow: inset 0 -2px 0 var(--gold);
}

.user-strip {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  color: rgba(255, 255, 255, 0.84);
}

.user-avatar {
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  color: #173823;
  background: #f2c45f;
  font-weight: 900;
}

.user-name {
  max-width: 132px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 700;
}

.page {
  width: min(1180px, calc(100% - 32px));
  margin: 30px auto 52px;
}

.app-layout .topbar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  gap: 26px;
  padding: 20px 14px;
  background:
    linear-gradient(180deg, #143725 0%, #174f34 58%, #1f6b46 100%);
  border-right: 1px solid rgba(255, 255, 255, 0.12);
  border-bottom: 0;
  box-shadow: 18px 0 42px rgba(20, 55, 37, 0.16);
  z-index: 50;
}

.app-layout .brand {
  width: 100%;
  min-width: 0;
  color: #fff;
}

.app-layout .brand-mark {
  width: 46px;
  height: 46px;
}

.app-layout .brand-mark img {
  width: 32px;
  height: 32px;
}

.app-layout .brand-copy strong {
  font-size: 19px;
}

.app-layout .nav {
  width: 100%;
  display: grid;
  flex: 0 0 auto;
  align-items: stretch;
  justify-content: stretch;
  gap: 8px;
}

.nav-title {
  color: rgba(255, 255, 255, 0.62);
  font-size: 13px;
  font-weight: 800;
  padding: 0 6px 4px;
}

.app-layout .nav-link {
  width: 100%;
  min-height: 42px;
  justify-content: flex-start;
  padding: 9px 12px;
  border-radius: 6px;
  color: rgba(255, 255, 255, 0.82);
  font-size: 17px;
  font-weight: 900;
}

.app-layout .nav-link.active,
.app-layout .nav-link:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.18);
  box-shadow: inset 3px 0 0 var(--gold);
}

.nav-group {
  display: grid;
  gap: 4px;
}

.nav-group > summary {
  cursor: pointer;
  list-style: none;
}

.nav-group > summary::-webkit-details-marker {
  display: none;
}

.nav-group-title::after {
  content: "▾";
  margin-left: auto;
  color: rgba(255, 255, 255, 0.62);
  font-size: 13px;
  transition: transform 160ms ease;
}

.nav-group:not([open]) .nav-group-title::after {
  transform: rotate(-90deg);
}

.nav-submenu {
  display: grid;
  gap: 3px;
  padding: 0 0 4px 14px;
}

.nav-sublink {
  min-height: 34px;
  display: flex;
  align-items: center;
  padding: 7px 12px;
  border-left: 2px solid rgba(255, 255, 255, 0.14);
  border-radius: 6px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 14px;
  font-weight: 800;
}

.nav-sublink:hover,
.nav-sublink.active {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  border-left-color: var(--gold);
}

.app-layout .user-strip {
  width: 100%;
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  color: rgba(255, 255, 255, 0.86);
}

.app-layout .page {
  width: calc(100vw - var(--sidebar-width) - 48px);
  max-width: none;
  margin: 30px 24px 52px calc(var(--sidebar-width) + 24px);
}

.initial-entry .app-layout .brand,
.initial-entry .app-layout .nav-title,
.initial-entry .app-layout .nav-link,
.initial-entry .app-layout .nav-sublink,
.initial-entry .app-layout .user-strip,
.app-layout .page > * {
  opacity: 0;
  animation: ui-fade-in 280ms ease-out forwards;
}

.initial-entry .app-layout .nav-title { animation-delay: 60ms; }
.initial-entry .app-layout .nav-link { animation-delay: 100ms; }
.initial-entry .app-layout .nav-sublink { animation-delay: 130ms; }
.initial-entry .app-layout .user-strip { animation-delay: 180ms; }
.app-layout .page > *:nth-child(1) { animation-delay: 40ms; }
.app-layout .page > *:nth-child(2) { animation-delay: 80ms; }
.app-layout .page > *:nth-child(3) { animation-delay: 120ms; }
.app-layout .page > *:nth-child(4) { animation-delay: 160ms; }

.route-transition .app-layout .brand,
.route-transition .app-layout .nav-title,
.route-transition .app-layout .nav-link,
.route-transition .app-layout .nav-sublink,
.route-transition .app-layout .user-strip {
  animation: none;
  opacity: 1;
}

.page-is-leaving .page > * {
  animation: ui-fade-out 180ms ease-in forwards;
}

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(31, 91, 61, 0.16);
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--gold);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  line-height: 1.25;
}

h1 {
  font-size: 27px;
  font-weight: 900;
}

h2 {
  font-size: 18px;
  font-weight: 850;
  margin-bottom: 14px;
}

p {
  margin: 8px 0 0;
  color: var(--muted);
}

.panel,
.auth-panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.panel {
  padding: 22px;
  margin-bottom: 18px;
}

.narrow {
  max-width: 520px;
}

.auth-layout .page {
  width: min(1040px, calc(100% - 32px));
  margin-top: 54px;
}

.auth-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(340px, 420px);
  align-items: center;
  gap: 34px;
  min-height: calc(100vh - 190px);
}

.auth-intro {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  align-items: center;
  gap: 20px;
  min-width: 0;
}

.auth-logo {
  width: 82px;
  height: 82px;
  padding: 10px;
  border: 1px solid rgba(31, 91, 61, 0.15);
  border-radius: 8px;
  background: linear-gradient(135deg, #fffbe9 0%, #f3cf77 100%);
  box-shadow: 0 20px 48px rgba(20, 55, 37, 0.16);
}

.auth-intro h1 {
  font-size: 38px;
}

.auth-intro p:not(.eyebrow) {
  max-width: 560px;
  color: #4f6358;
  font-size: 16px;
}

.auth-panel {
  padding: 26px;
}

.auth-panel h2 {
  margin-bottom: 20px;
}

.form-grid {
  display: grid;
  gap: 14px;
}

.admin-create-grid {
  display: grid;
  grid-template-columns: 1.2fr 1.2fr 170px 170px 110px auto;
  align-items: end;
  gap: 12px;
}

.user-edit-grid {
  display: grid;
  grid-template-columns: minmax(126px, 1fr) minmax(126px, 1fr) 76px 68px minmax(128px, 1fr) 60px;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.password-reset-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 58px;
  gap: 6px;
  min-width: 0;
}

.password-reset-form input {
  min-width: 0;
}

.account-action-stack {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.account-delete-form {
  display: flex;
  justify-content: flex-end;
}

.upload-row {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto auto;
  align-items: center;
  gap: 12px;
}

.upload-dropzone {
  min-height: 46px;
  display: flex;
  align-items: center;
  padding: 10px 14px;
  border: 1px dashed #a8b9a3;
  border-radius: 6px;
  background: #fbfcf8;
  color: var(--muted);
  font-weight: 700;
  min-width: 0;
}

.upload-dropzone.is-dragging {
  border-color: #1f6b46;
  background: #edf7ef;
  color: #174f34;
  box-shadow: 0 0 0 3px rgba(31, 107, 70, 0.12);
}

.upload-dropzone span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  clip-path: inset(50%);
}

.upload-select-button {
  white-space: nowrap;
}

label {
  display: grid;
  gap: 6px;
  color: #536358;
  font-size: 13px;
  font-weight: 700;
}

.check-label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  color: var(--text);
}

.compact {
  min-height: auto;
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="datetime-local"],
select,
textarea,
input:not([type]) {
  width: 100%;
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  font: inherit;
  outline: none;
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
input[type="date"]:focus,
input[type="datetime-local"]:focus,
select:focus,
textarea:focus,
input:not([type]):focus {
  border-color: #78a782;
  box-shadow: 0 0 0 3px rgba(31, 91, 61, 0.12);
}

textarea {
  resize: vertical;
}

input[type="file"] {
  width: 100%;
  padding: 8px;
  border: 1px dashed #a8b9a3;
  border-radius: 6px;
  background: #fbfcf8;
}

input[type="date"] {
  min-width: 170px;
}

.readonly-cell {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  padding: 8px 10px;
  color: var(--muted);
  background: var(--panel-muted);
  border: 1px solid var(--border);
  border-radius: 6px;
  white-space: nowrap;
}

button,
.small-button,
.primary-button,
.danger-button {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 8px 13px;
  cursor: pointer;
  font: inherit;
  font-weight: 800;
  white-space: nowrap;
}

.primary-button {
  color: #fff;
  background: linear-gradient(180deg, #276646 0%, var(--primary) 100%);
  border-color: #1b4d34;
  box-shadow: 0 10px 20px rgba(31, 91, 61, 0.16);
}

.primary-button:hover {
  background: var(--primary-dark);
}

.small-button {
  color: var(--primary);
  background: var(--primary-soft);
  border-color: #bfd3c0;
}

.small-button:hover {
  background: #dcece1;
  border-color: #9fb99f;
}

.danger-button {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: #f2bdb4;
}

.danger-button:hover {
  background: #ffe5df;
}

.mode-pill,
.settlement-pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.mode-manual {
  color: #445148;
  background: #eef2ed;
  border: 1px solid #ccd7c9;
}

.mode-auto,
.settlement-paid {
  color: var(--success-text);
  background: var(--success-bg);
  border: 1px solid #aad6b8;
}

.settlement-pending {
  color: var(--warning-text);
  background: var(--warning-bg);
  border: 1px solid #f3d283;
}

.settlement-submitted {
  color: #1d4f8f;
  background: #e8f1ff;
  border: 1px solid #b7cff3;
}

.link-button {
  color: #fff8dc;
  min-height: 32px;
  padding: 6px 10px;
  background: rgba(217, 145, 40, 0.18);
  border-color: rgba(255, 224, 154, 0.26);
}

.link-button:hover {
  background: rgba(217, 145, 40, 0.28);
}

.inline-form {
  display: inline;
}

.flash-stack {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 1000;
  width: min(360px, calc(100vw - 32px));
  display: grid;
  gap: 8px;
  pointer-events: none;
  animation: toast-slide-in 180ms ease-out;
}

.flash-stack.is-hiding {
  animation: toast-fade-out 500ms ease-in forwards;
}

.flash {
  border-radius: 6px;
  padding: 12px 14px;
  border: 1px solid transparent;
  box-shadow: 0 14px 34px rgba(20, 55, 37, 0.18);
  font-weight: 700;
}

.flash.success {
  background: var(--success-bg);
  color: var(--success-text);
  border-color: #b8dcc3;
}

.flash.error {
  background: var(--error-bg);
  color: var(--error-text);
  border-color: #f0c3c3;
}

.flash.warning {
  background: var(--warning-bg);
  color: var(--warning-text);
  border-color: #f1d383;
}

.persistent-warning {
  border-radius: 6px;
  padding: 10px 12px;
  border: 1px solid #f1d383;
  background: var(--warning-bg);
  color: var(--warning-text);
  font-weight: 700;
  margin-bottom: 16px;
}

@keyframes toast-slide-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes toast-fade-out {
  to {
    opacity: 0;
    transform: translateY(10px);
  }
}

@keyframes ui-fade-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes ui-fade-out {
  to {
    opacity: 0;
    transform: translateY(-8px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .app-layout .brand,
  .app-layout .nav-title,
  .app-layout .nav-link,
  .app-layout .nav-sublink,
  .app-layout .user-strip,
  .app-layout .page > *,
  .page-is-leaving .page > * {
    animation: none;
    opacity: 1;
  }
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

.table-scrollbar {
  width: 100%;
  height: 16px;
  margin: 0 0 8px;
  overflow-x: auto;
  overflow-y: hidden;
}

.table-scrollbar-floating {
  position: fixed;
  bottom: 0;
  left: calc(var(--sidebar-width) + 24px);
  right: auto;
  z-index: 900;
  width: auto;
  margin: 0;
  padding: 3px 0;
  background: rgba(238, 245, 238, 0.86);
  border-radius: 999px;
  box-shadow: 0 8px 24px rgba(20, 55, 37, 0.16);
}

.table-scrollbar[hidden] {
  display: none;
}

.table-scrollbar-inner {
  height: 1px;
}

.table-scrollbar::-webkit-scrollbar,
.table-wrap::-webkit-scrollbar {
  height: 12px;
}

.table-scrollbar::-webkit-scrollbar-track,
.table-wrap::-webkit-scrollbar-track {
  background: #eef5ee;
  border-radius: 999px;
}

.table-scrollbar::-webkit-scrollbar-thumb,
.table-wrap::-webkit-scrollbar-thumb {
  background: #8fa094;
  border: 3px solid #eef5ee;
  border-radius: 999px;
}

.table-scrollbar::-webkit-scrollbar-thumb:hover,
.table-wrap::-webkit-scrollbar-thumb:hover {
  background: #667a6c;
}

table {
  width: 100%;
  min-width: 760px;
  border-collapse: separate;
  border-spacing: 0;
}

.admin-users-table {
  min-width: 930px;
  table-layout: fixed;
}

.admin-users-table input[type="date"] {
  min-width: 0;
}

th,
td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
}

th {
  color: #425246;
  background: #f2f6ef;
  font-size: 13px;
  font-weight: 900;
}

tbody tr:hover td {
  background: rgba(230, 241, 233, 0.50);
}

tr:last-child td {
  border-bottom: 0;
}

.actions {
  width: 180px;
  text-align: right;
}

.wide-actions {
  width: 220px;
}

.actions form {
  margin-left: 8px;
}

.muted {
  color: var(--muted);
}

.section-line {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.section-line h2 {
  margin-bottom: 0;
}

.status-count {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 5px 10px;
  border: 1px solid #d9c38d;
  border-radius: 6px;
  color: #624000;
  background: var(--gold-soft);
  font-weight: 900;
  white-space: nowrap;
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.select-col {
  width: 58px;
  text-align: center;
}

.settlement-batch-bar {
  display: grid;
  grid-template-columns: 180px minmax(220px, 1fr) auto;
  align-items: end;
  gap: 12px;
  padding: 14px;
  margin-bottom: 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-muted);
}

.batch-remark textarea {
  min-height: 40px;
}

.settlement-table {
  min-width: 1480px;
}

.settlement-table .select-col {
  width: 44px;
  min-width: 44px;
  max-width: 44px;
  padding: 12px 6px;
  position: sticky;
  left: 0;
  z-index: 2;
  background: inherit;
  text-align: center;
  vertical-align: middle;
}

.settlement-table th.select-col {
  z-index: 3;
  background: var(--panel-muted);
}

.settlement-table tbody tr:nth-child(odd) td {
  background: var(--panel-muted);
}

.settlement-table tbody tr:nth-child(even) td {
  background: var(--panel);
}

.settlement-table tbody tr:hover td {
  background: rgba(230, 241, 233, 0.95);
}

.settlement-table .select-col input[type="checkbox"] {
  display: block;
  width: 14px;
  height: 14px;
  margin: 0 auto;
  accent-color: #1f6b46;
  opacity: 1;
}

.settlement-table .select-col input[type="checkbox"]:disabled {
  accent-color: #8fa094;
  opacity: 0.55;
}

.settlement-check {
  display: inline-flex;
  grid-template-columns: none;
  align-items: center;
  gap: 9px;
  color: var(--text);
  font-size: 15px;
}

.settlement-check input[type="checkbox"] {
  margin: 0;
}

.settlement-card {
  display: none;
}

.settlement-single-form {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.settlement-inline-form {
  display: grid;
  grid-template-columns: 104px 142px 132px 58px;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.settlement-inline-form input[type="file"] {
  max-width: 142px;
}

.settlement-inline-form textarea {
  min-width: 0;
  width: 100%;
}

.actions .settlement-inline-form {
  margin-left: 0;
}

.settlement-inline-form select,
.settlement-inline-form input[type="file"],
.settlement-inline-form textarea {
  min-width: 0;
}

.empty {
  color: var(--muted);
  text-align: center;
  padding: 28px 12px;
}

.muted {
  color: var(--muted);
}

.sync-panel {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(260px, 0.9fr) auto;
  align-items: center;
  gap: 18px;
  padding: 22px;
  margin-bottom: 18px;
  color: #fff;
  background:
    linear-gradient(90deg, rgba(217, 145, 40, 0.20) 0%, rgba(217, 145, 40, 0) 36%),
    linear-gradient(135deg, #143725 0%, #1f5b3d 100%);
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 8px;
  box-shadow: 0 18px 38px rgba(20, 55, 37, 0.18);
}

.sync-panel h2,
.sync-panel p {
  color: #fff;
}

.sync-panel p {
  color: rgba(255, 255, 255, 0.76);
}

.sync-panel .small-button {
  color: #163725;
  background: #fff4d8;
  border-color: rgba(255, 255, 255, 0.30);
}

.sync-copy h2 {
  margin-bottom: 6px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.metric {
  min-height: 76px;
  display: grid;
  align-content: center;
  gap: 5px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.10);
}

.metric span {
  color: rgba(255, 255, 255, 0.68);
  font-size: 12px;
  font-weight: 800;
}

.metric strong {
  overflow-wrap: anywhere;
  color: #fff;
  font-size: 18px;
  line-height: 1.2;
}

.button-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.search-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.search-row input {
  flex: 1 1 auto;
}

.search-row .search-input {
  min-width: 180px;
}

.date-filter {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 1 190px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.date-filter input {
  min-width: 0;
}

.mobile-record-list {
  display: grid;
  gap: 12px;
}

.mobile-record-card {
  display: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  background: var(--panel-muted);
}

.mobile-record-card p {
  margin-top: 6px;
}

.mobile-record-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.record-table-wide {
  min-width: 1760px;
}

.record-table-wide.settlement-table {
  min-width: 1680px;
}

.record-table-wide.settlement-table th.select-col,
.record-table-wide.settlement-table td.select-col {
  width: 44px;
  min-width: 44px;
}

.record-table-wide.settlement-table .wide-actions {
  min-width: 488px;
  width: 488px;
  text-align: right;
}

.record-table-wide.settlement-table th.wide-actions {
  padding-right: 18px;
}

.record-table-wide.settlement-table td.wide-actions {
  padding-left: 8px;
  padding-right: 10px;
}

.record-table-wide.settlement-table .settlement-inline-form {
  width: 470px;
  margin-left: auto;
}

.record-table-wide.settlement-table .settlement-inline-form .small-button {
  width: 58px;
  justify-content: center;
}

.records-wide-section {
  width: 100%;
  max-width: none;
}

.record-table-wide th,
.record-table-wide td {
  white-space: nowrap;
}

.record-table-wide th:nth-child(1),
.record-table-wide td:nth-child(1) {
  min-width: 156px;
}

.record-table-wide th:nth-child(2),
.record-table-wide td:nth-child(2),
.record-table-wide th:nth-child(3),
.record-table-wide td:nth-child(3),
.record-table-wide th:nth-child(4),
.record-table-wide td:nth-child(4),
.record-table-wide th:nth-child(5),
.record-table-wide td:nth-child(5) {
  min-width: 92px;
}

.record-table-wide th:nth-child(8),
.record-table-wide td:nth-child(8),
.record-table-wide th:nth-child(9),
.record-table-wide td:nth-child(9) {
  min-width: 132px;
}

.record-table-wide th:nth-child(16),
.record-table-wide td:nth-child(16) {
  min-width: 168px;
}

.record-table-wide th:nth-child(17),
.record-table-wide td:nth-child(17) {
  min-width: 156px;
}

.record-table-wide th:nth-child(18),
.record-table-wide td:nth-child(18) {
  min-width: 126px;
}

.record-table-wide td.actions .small-button {
  min-width: 86px;
  justify-content: center;
}

.record-table-wide:not(.settlement-table) th.actions,
.record-table-wide:not(.settlement-table) td.actions {
  min-width: 126px;
  padding-left: 8px;
  padding-right: 10px;
}

.desktop-only {
  display: block;
}

@media (max-width: 980px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
    padding: 14px 18px;
  }

  .brand {
    min-width: 0;
  }

  .nav {
    justify-content: flex-start;
    width: 100%;
  }

  .user-strip {
    width: 100%;
    justify-content: flex-start;
  }

  .auth-shell {
    grid-template-columns: 1fr;
    align-items: start;
    min-height: auto;
  }

  .auth-intro h1 {
    font-size: 30px;
  }

  .sync-panel {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 860px) {
  .section-head,
  .section-line,
  .upload-row,
  .search-row {
    align-items: stretch;
    flex-direction: column;
  }

  .date-filter {
    width: 100%;
  }

  .page,
  .auth-layout .page {
    width: min(100% - 20px, 1180px);
    margin-top: 18px;
  }

  .panel,
  .auth-panel,
  .sync-panel {
    padding: 16px;
  }

  .auth-intro {
    grid-template-columns: 62px minmax(0, 1fr);
    gap: 14px;
  }

  .auth-logo {
    width: 62px;
    height: 62px;
  }

  .admin-create-grid {
    grid-template-columns: 1fr;
  }

  .user-edit-grid {
    grid-template-columns: 1fr 1fr;
  }

  .password-reset-form {
    grid-template-columns: 1fr;
  }

  .metric-grid {
    grid-template-columns: 1fr;
  }

  .settlement-batch-bar,
  .settlement-inline-form {
    grid-template-columns: 1fr;
  }

  .settlement-batch-bar {
    align-items: stretch;
  }

  .desktop-only {
    display: none;
  }

  .mobile-record-card {
    display: block;
  }
}

@media (max-width: 520px) {
  body {
    font-size: 14px;
  }

  .brand-copy strong {
    font-size: 15px;
  }

  .brand-copy span {
    font-size: 11px;
  }

  .nav-link {
    padding: 7px 9px;
  }

  .auth-intro {
    grid-template-columns: 1fr;
  }

  .auth-intro h1 {
    font-size: 25px;
  }

  h1 {
    font-size: 24px;
  }

  .button-row,
  .actions {
    text-align: left;
  }
}
