:root {
  color-scheme: light;
  --bg: #f5f7fa;
  --panel: #ffffff;
  --text: #1f2937;
  --muted: #64748b;
  --border: #dbe2ea;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --success: #16803c;
  --warning: #9a6700;
  --danger: #b42318;
  --soft-blue: #eaf1ff;
  --soft-green: #eaf7ef;
  --soft-amber: #fff4d6;
  --shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--text);
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 28px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(10px);
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 22px;
  font-weight: 700;
}

h2 {
  font-size: 17px;
}

.section-title span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.top-actions,
.form-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

button {
  min-height: 36px;
  padding: 0 14px;
  border: 0;
  border-radius: 6px;
  background: var(--primary);
  color: #ffffff;
  font-weight: 700;
  cursor: pointer;
}

button:hover {
  background: var(--primary-dark);
}

button.secondary {
  border: 1px solid var(--border);
  background: #ffffff;
  color: var(--text);
}

button.secondary:hover {
  background: #f1f5f9;
}

button.danger {
  background: var(--danger);
}

a.text-link {
  color: var(--primary);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
}

a.text-link:hover {
  text-decoration: underline;
}

.link-button {
  min-height: auto;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--danger);
  font-weight: 700;
}

.link-button:hover {
  background: transparent;
  color: #7a271a;
  text-decoration: underline;
}

.layout {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 22px 28px 36px;
}

.ledger-layout {
  width: min(1680px, 100%);
}

.apply-body {
  background: #f7f9fc;
}

.apply-topbar {
  position: static;
}

.apply-layout {
  width: min(960px, 100%);
  margin: 0 auto;
  padding: 22px 18px 40px;
}

.identity-gate {
  display: grid;
  gap: 8px;
  padding: 24px;
}

.identity-gate[hidden] {
  display: none;
}

.identity-gate h2 {
  color: #172033;
}

.identity-gate p {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(135deg, #edf4fb 0%, #f8fbfd 52%, #eef8f1 100%);
}

.login-shell {
  width: min(900px, 100%);
  min-height: 460px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  overflow: hidden;
  border: 1px solid #d6e0eb;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 22px 56px rgba(31, 41, 55, 0.12);
}

.login-visual {
  display: grid;
  align-content: center;
  gap: 24px;
  padding: 42px 48px;
  border-right: 1px solid #dbe7f3;
  background: #f2f7fc;
}

.login-visual img {
  width: 186px;
  height: auto;
}

.login-visual h1 {
  color: #15304f;
  font-size: 30px;
  line-height: 1.2;
}

.login-visual p {
  max-width: 340px;
  margin-top: 10px;
  color: #52657a;
  font-size: 14px;
  line-height: 1.8;
}

.login-card {
  display: grid;
  align-content: center;
  gap: 18px;
  padding: 42px 36px;
}

.login-card-head {
  display: grid;
  gap: 8px;
}

.login-card-head span {
  color: var(--primary);
  font-size: 13px;
  font-weight: 800;
}

.login-card-head h2 {
  color: #172033;
  font-size: 24px;
}

.login-form {
  display: grid;
  gap: 15px;
}

.login-form input {
  min-height: 42px;
}

.login-form button {
  min-height: 42px;
  margin-top: 4px;
}

.login-error {
  padding: 10px 12px;
  border: 1px solid #fecaca;
  border-radius: 6px;
  background: #fff5f5;
  color: var(--danger);
  font-size: 13px;
  font-weight: 700;
}

.logout-link {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #ffffff;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}

.logout-link:hover {
  background: #f1f5f9;
}

.grid {
  display: grid;
  gap: 18px;
  margin-top: 18px;
}

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

.panel {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.section-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border);
}

.ledger-toolbar {
  display: grid;
  grid-template-columns: minmax(150px, 210px) minmax(240px, 320px) auto;
  align-items: end;
  gap: 10px;
}

.ledger-subject,
.ledger-search {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 13px;
}

.ledger-search input {
  width: 100%;
  min-height: 36px;
}

.ledger-subject select {
  width: 100%;
  min-height: 36px;
}

.filter-reset {
  min-height: 38px;
  white-space: nowrap;
}

.filter-reset:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.column-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.column-filter-trigger,
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 26px;
  min-height: 26px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  font-size: 15px;
  line-height: 1;
}

.column-filter-trigger:hover,
.icon-button:hover {
  border-color: var(--border);
  background: #eef2f7;
  color: var(--text);
}

.column-filter-trigger.is-active {
  border-color: #b8ccff;
  background: var(--soft-blue);
  color: var(--primary);
}

.column-filter-popover {
  position: fixed;
  z-index: 20;
  display: grid;
  gap: 10px;
  max-height: 420px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #ffffff;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.18);
}

.column-filter-popover[hidden] {
  display: none;
}

.column-filter-head,
.column-filter-actions,
.column-filter-actions > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.column-filter-head strong {
  font-size: 14px;
}

.column-filter-popover input[type="search"] {
  min-height: 36px;
}

.filter-select-all,
.filter-option {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  color: var(--text);
  cursor: pointer;
}

.filter-select-all {
  padding: 2px 4px 8px;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
}

.filter-select-all input,
.filter-option input {
  width: 16px;
  min-height: 16px;
  margin: 0;
  padding: 0;
  accent-color: var(--primary);
}

.filter-option-list {
  min-height: 52px;
  max-height: 220px;
  overflow: auto;
}

.filter-option {
  min-height: 34px;
  padding: 6px 4px;
  border-radius: 4px;
}

.filter-option:hover {
  background: #f1f5f9;
}

.filter-option span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.filter-option-empty,
.empty-table {
  color: var(--muted);
  text-align: center;
}

.filter-option-empty {
  padding: 18px 8px;
  font-size: 13px;
}

.column-filter-actions {
  padding-top: 2px;
}

.column-filter-actions button {
  min-height: 34px;
  padding: 0 12px;
}

.empty-table {
  height: 100px;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  background: var(--border);
}

.metrics div {
  min-height: 90px;
  padding: 18px;
  background: #ffffff;
}

.metrics span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.metrics strong {
  display: block;
  margin-top: 10px;
  font-size: 28px;
}

.form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding: 18px 20px 6px;
}

.apply-form {
  padding-bottom: 20px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

input,
select,
textarea {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  color: var(--text);
  background: #ffffff;
  font: inherit;
}

.apply-form input[readonly] {
  background: #f8fafc;
  color: #334155;
  cursor: default;
}

textarea {
  resize: vertical;
}

.wide {
  grid-column: 1 / -1;
}

.people-block {
  display: grid;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fbfdff;
}

.activity-people-block {
  gap: 12px;
}

.allocation-block {
  display: grid;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fbfdff;
}

.people-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.people-head h3 {
  margin: 0;
  font-size: 15px;
}

.people-head p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.amount-chip {
  display: grid;
  min-width: 118px;
  gap: 2px;
  padding: 8px 10px;
  border: 1px solid #c7d7fe;
  border-radius: 8px;
  background: #eff6ff;
  text-align: right;
}

.amount-chip span {
  color: var(--muted);
  font-size: 12px;
}

.amount-chip strong {
  color: var(--primary);
  font-size: 18px;
}

.summary-strip {
  display: grid;
  grid-template-columns: repeat(2, minmax(112px, 1fr));
  gap: 8px;
  min-width: min(292px, 100%);
}

.summary-strip div {
  min-height: 58px;
  padding: 8px 10px;
  border: 1px solid #c7d7fe;
  border-radius: 8px;
  background: #eff6ff;
}

.summary-strip span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.summary-strip strong {
  display: block;
  margin-top: 6px;
  color: var(--primary);
  font-size: 17px;
}

.month-groups {
  display: grid;
  gap: 12px;
}

.month-group {
  position: relative;
  display: grid;
  gap: 12px;
  padding: 12px 46px 12px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
}

.month-group-head {
  display: grid;
  gap: 7px;
}

.month-field-label {
  color: var(--muted);
  font-size: 12px;
}

.month-picker-trigger {
  width: 100%;
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #ffffff;
  color: var(--text);
  font-weight: 400;
  text-align: left;
}

.month-picker-trigger:hover {
  border-color: var(--primary);
  background: #ffffff;
}

.month-picker-trigger-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.month-picker-trigger-text.is-placeholder {
  color: var(--muted);
}

.month-picker-chevron {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 18px;
}

.month-group-remove {
  position: absolute;
  top: 10px;
  right: 10px;
  border-color: var(--border);
  background: #ffffff;
  color: var(--muted);
}

.month-group-remove:hover {
  border-color: #f0b7b2;
  background: #fff1f0;
  color: var(--danger);
}

.person-add-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.person-picker-trigger {
  justify-self: stretch;
  width: 100%;
  text-align: left;
}

.group-people-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 34px;
}

.person-chip {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  min-height: 30px;
  gap: 8px;
  padding: 4px 8px 4px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #f8fafc;
  color: var(--text);
  font-size: 13px;
}

.person-chip span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.person-chip button {
  width: 22px;
  min-height: 22px;
  padding: 0;
  border-radius: 999px;
  background: #e2e8f0;
  color: var(--text);
  line-height: 1;
}

.person-chip button:hover {
  background: #cbd5e1;
}

.empty-inline {
  display: flex;
  align-items: center;
  min-height: 34px;
  color: var(--muted);
  font-size: 13px;
}

.add-month-btn {
  justify-self: start;
}

.modal-open {
  overflow: hidden;
}

.month-picker-backdrop {
  position: fixed;
  inset: 0;
  z-index: 55;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(15, 23, 42, 0.42);
}

.month-picker-backdrop[hidden] {
  display: none;
}

.month-picker {
  width: min(520px, 100%);
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 24px 64px rgba(15, 23, 42, 0.24);
}

.month-picker-head,
.month-picker-foot,
.month-picker-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.month-picker-head {
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
}

.month-picker-head h2 {
  font-size: 17px;
}

.month-picker-head span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.month-picker-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  padding: 20px 18px;
}

.month-picker-option {
  min-height: 42px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #ffffff;
  color: var(--text);
}

.month-picker-option:hover:not(:disabled) {
  border-color: var(--primary);
  background: var(--soft-blue);
  color: var(--primary);
}

.month-picker-option.is-selected {
  border-color: var(--primary);
  background: var(--primary);
  color: #ffffff;
}

.month-picker-option:disabled {
  border-color: #e5e7eb;
  background: #f3f4f6;
  color: #9ca3af;
  cursor: not-allowed;
}

.month-picker-foot {
  padding: 12px 18px;
  border-top: 1px solid var(--border);
}

.month-picker-foot > strong {
  color: var(--primary);
  font-size: 13px;
}

.employee-picker-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(15, 23, 42, 0.42);
}

.employee-picker-backdrop[hidden] {
  display: none;
}

.employee-picker {
  width: min(900px, 100%);
  max-height: min(680px, calc(100vh - 40px));
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 24px 64px rgba(15, 23, 42, 0.24);
}

.employee-picker-head,
.employee-picker-actions,
.employee-picker-selected-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.employee-picker-head {
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
}

.employee-picker-head h2 {
  font-size: 17px;
}

.employee-picker-head span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.employee-picker-body {
  min-height: 420px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 0.42fr);
  overflow: hidden;
}

.employee-picker-browser {
  min-width: 0;
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  overflow: hidden;
}

.employee-picker-browser > input[type="search"] {
  grid-column: 1 / -1;
  margin: 14px;
  width: calc(100% - 28px);
}

.employee-picker-departments {
  grid-column: 1;
  grid-row: 2 / 5;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: auto;
  padding: 4px 8px 12px;
  border-right: 1px solid var(--border);
}

.picker-department {
  width: 100%;
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 10px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--text);
  text-align: left;
}

.picker-department:hover {
  background: #f1f5f9;
}

.picker-department.is-active {
  background: var(--soft-blue);
  color: var(--primary);
}

.picker-department span {
  color: var(--muted);
  font-size: 12px;
}

.employee-picker-select-all {
  grid-column: 2;
  grid-row: 2;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font-weight: 700;
}

.employee-picker-select-all input,
.employee-picker-row input {
  width: 16px;
  min-height: 16px;
  margin: 0;
  padding: 0;
  accent-color: var(--primary);
}

.employee-picker-list {
  grid-column: 2;
  grid-row: 3;
  overflow: auto;
  padding: 4px 8px 10px;
}

.employee-picker-row {
  grid-template-columns: 18px 34px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  min-height: 52px;
  padding: 7px 6px;
  border-radius: 4px;
  color: var(--text);
  cursor: pointer;
}

.employee-picker-row:hover {
  background: #f6f8fb;
}

.employee-picker-avatar {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #eaf1ff;
  color: var(--primary);
  font-weight: 700;
}

.employee-picker-person,
.employee-picker-selected-item > span {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.employee-picker-person strong,
.employee-picker-selected-item strong {
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.employee-picker-person small,
.employee-picker-selected-item small {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.employee-picker-empty {
  grid-column: 2;
  grid-row: 3;
  align-self: center;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.employee-picker-selected {
  min-width: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
  border-left: 1px solid var(--border);
}

.employee-picker-selected-head {
  min-height: 50px;
  padding: 0 14px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.employee-picker-selected-head strong {
  color: var(--primary);
}

.employee-picker-selected-list {
  overflow: auto;
  padding: 8px;
}

.employee-picker-selected-item {
  min-height: 50px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 7px 6px;
  border-bottom: 1px solid #eef2f6;
}

.employee-picker-empty-selection {
  padding: 28px 8px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.employee-picker-actions {
  justify-content: flex-end;
  padding: 12px 18px;
  border-top: 1px solid var(--border);
}

.people-table-wrap {
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
}

.people-table th,
.people-table td {
  padding: 10px 12px;
}

.empty-cell {
  color: var(--muted);
  text-align: center;
}

.apply-actions {
  justify-content: flex-end;
  grid-column: 1 / -1;
}

.result-panel {
  margin-top: 16px;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.result-panel.hidden {
  display: none;
}

.result-panel.success {
  border-color: #bbf7d0;
  background: #f0fdf4;
}

.result-panel.error {
  border-color: #fecaca;
  background: #fff5f5;
}

.result-panel.info {
  border-color: #bfdbfe;
  background: #eff6ff;
}

.result-title {
  font-weight: 800;
}

.result-body {
  margin-top: 8px;
  color: var(--text);
  font-size: 14px;
}

.result-body p {
  margin-top: 4px;
}

.result-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 16px;
}

.result-actions[hidden] {
  display: none;
}

.result {
  min-height: 92px;
  margin: 12px 20px 20px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #f8fafc;
  white-space: pre-wrap;
  color: var(--text);
  overflow: auto;
}

.codebox {
  display: block;
  width: calc(100% - 40px);
  min-height: 272px;
  margin: 18px 20px 14px;
  font-family: Consolas, "Courier New", monospace;
  font-size: 13px;
}

.panel > .form-actions {
  padding: 0 20px 20px;
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  font-size: 13px;
  white-space: nowrap;
}

th {
  color: var(--muted);
  font-weight: 700;
  background: #f8fafc;
}

.employee-table {
  max-height: 430px;
}

.matrix-table {
  max-height: 540px;
}

.ledger-table {
  max-height: calc(100vh - 170px);
}

.month {
  text-align: center;
  min-width: 68px;
}

.month.available {
  color: #166534;
  background: #ecfdf3;
}

.month.reserved {
  color: #92400e;
  background: #fffbeb;
}

.month.used {
  color: #1d4ed8;
  background: #eff6ff;
}

.month.ineligible {
  color: #64748b;
  background: #f1f5f9;
}

.amount-cell {
  color: var(--success);
  font-weight: 700;
}

.remark-cell {
  min-width: 120px;
  color: var(--muted);
}

.remark {
  color: var(--danger);
}

.list {
  display: grid;
  gap: 12px;
  padding: 16px 20px 20px;
}

.item {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  background: #ffffff;
}

.item-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.item-title {
  font-weight: 700;
}

.item-meta,
.participants {
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.badge.pending,
.badge.reserved,
.badge.submitted {
  color: var(--warning);
  background: var(--soft-amber);
}

.badge.approved {
  color: var(--success);
  background: var(--soft-green);
}

.badge.rejected,
.badge.canceled,
.badge.failed {
  color: var(--danger);
  background: #fee4e2;
}

.item-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

@media (max-width: 900px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
    padding: 16px;
  }

  .section-title {
    align-items: stretch;
    flex-direction: column;
  }

  .ledger-toolbar {
    grid-template-columns: minmax(150px, 210px) minmax(0, 1fr) auto;
    width: 100%;
  }

  .layout {
    padding: 16px;
  }

  .grid.two,
  .metrics,
  .form {
    grid-template-columns: 1fr;
  }

  .person-add-row,
  .people-head,
  .month-group-head,
  .summary-strip {
    grid-template-columns: 1fr;
    flex-direction: column;
  }

  .amount-chip {
    width: 100%;
    text-align: left;
  }

  .metrics div {
    min-height: 74px;
  }
}

@media (max-width: 620px) {
  .ledger-toolbar {
    grid-template-columns: 1fr;
  }

  .filter-reset {
    width: 100%;
  }

  .column-filter-popover {
    top: auto !important;
    right: 12px;
    bottom: 12px;
    left: 12px !important;
    width: auto !important;
    max-height: calc(100vh - 24px);
  }
}

@media (max-width: 760px) {
  .employee-picker-backdrop {
    align-items: stretch;
    padding: 0;
  }

  .employee-picker {
    width: 100%;
    max-height: 100vh;
    border: 0;
    border-radius: 0;
  }

  .employee-picker-body {
    min-height: 0;
    grid-template-columns: 1fr;
    overflow: auto;
  }

  .employee-picker-browser {
    min-height: 430px;
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto minmax(220px, 1fr);
  }

  .employee-picker-browser > input[type="search"],
  .employee-picker-departments,
  .employee-picker-select-all,
  .employee-picker-list,
  .employee-picker-empty {
    grid-column: 1;
  }

  .employee-picker-departments {
    grid-row: 2;
    flex-direction: row;
    padding: 0 14px 10px;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .picker-department {
    width: auto;
    flex: 0 0 auto;
  }

  .employee-picker-select-all {
    grid-row: 3;
  }

  .employee-picker-list,
  .employee-picker-empty {
    grid-row: 4;
  }

  .employee-picker-selected {
    min-height: 160px;
    max-height: 210px;
    border-top: 1px solid var(--border);
    border-left: 0;
  }

  .login-body {
    padding: 16px;
  }

  .login-shell {
    grid-template-columns: 1fr;
  }

  .login-visual {
    gap: 12px;
    padding: 28px 24px;
    border-right: 0;
    border-bottom: 1px solid #dbe7f3;
  }

  .login-visual img {
    width: 132px;
  }

  .login-visual h1 {
    font-size: 24px;
  }

  .login-card {
    padding: 28px 24px 30px;
  }
}
