:root {
  --bg: #f6f7f4;
  --panel: #ffffff;
  --panel-soft: #f0f4f1;
  --ink: #17211d;
  --muted: #69746e;
  --line: #d9dfda;
  --line-strong: #c2cbc5;
  --green: #16765d;
  --green-dark: #0f5846;
  --coral: #c96e4f;
  --amber: #b58125;
  --blue: #4269a5;
  --danger: #b84242;
  --shadow: 0 20px 45px rgba(22, 33, 29, 0.08);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family:
    Inter, "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

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

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px 18px;
  background: #18231e;
  color: #f8fbf8;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.brand {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: #f1f4ec;
  color: #18231e;
  border-radius: 8px;
  font-weight: 800;
  font-size: 22px;
}

.brand h1 {
  margin: 0;
  font-size: 20px;
  line-height: 1.15;
}

.brand p {
  margin: 4px 0 0;
  color: rgba(248, 251, 248, 0.7);
  font-size: 13px;
}

.nav-list {
  display: grid;
  gap: 8px;
}

.nav-item {
  width: 100%;
  padding: 12px 14px;
  color: rgba(248, 251, 248, 0.78);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  text-align: left;
}

.nav-item:hover,
.nav-item:focus-visible {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  outline: none;
}

.nav-item.is-active {
  color: #fff;
  background: #29443a;
  border-color: rgba(255, 255, 255, 0.1);
}

.side-note {
  margin-top: auto;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  color: rgba(248, 251, 248, 0.76);
  display: grid;
  gap: 6px;
}

.side-note strong {
  color: #fff;
}

.workspace {
  min-width: 0;
  padding: 28px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--green);
  font-weight: 700;
  font-size: 13px;
}

.topbar .eyebrow {
  display: none;
}

.topbar h2 {
  margin: 0;
  font-size: 28px;
  line-height: 1.15;
  letter-spacing: 0;
}

.top-actions {
  display: flex;
  align-items: end;
  gap: 12px;
  flex-wrap: wrap;
}

.auth-badge,
.env-badge {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  border-radius: 6px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  color: var(--muted);
  background: #fff;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.env-badge.dev {
  border-color: rgba(91, 107, 125, 0.26);
  color: #435062;
  background: rgba(91, 107, 125, 0.08);
}

.env-badge.test {
  border-color: rgba(180, 121, 32, 0.28);
  color: #8a5b12;
  background: rgba(180, 121, 32, 0.1);
}

.env-badge.prod {
  border-color: rgba(184, 66, 66, 0.28);
  color: var(--danger);
  background: rgba(184, 66, 66, 0.08);
}

.auth-badge.wecom {
  border-color: rgba(43, 138, 92, 0.28);
  color: var(--green-dark);
  background: rgba(43, 138, 92, 0.08);
}

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

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 6px;
  padding: 10px 11px;
  min-height: 40px;
}

input[type="file"] {
  padding: 8px 10px;
}

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

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid rgba(22, 118, 93, 0.22);
  border-color: var(--green);
}

.view {
  display: grid;
  gap: 18px;
}

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

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.panel-title {
  margin: 0;
  font-size: 18px;
  line-height: 1.25;
}

.panel-subtitle {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.panel-body {
  padding: 20px;
}

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

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

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

.stack {
  display: grid;
  gap: 18px;
}

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

.payment-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.inventory-workspace .panel-body {
  overflow-x: auto;
}

.payment-summary-grid.inventory-stats-grid {
  grid-template-columns: repeat(4, minmax(130px, 1fr));
  min-width: 600px;
  gap: 8px;
  margin-bottom: 10px;
}

.inventory-stats-grid .metric {
  padding: 6px 9px;
}

.inventory-stats-grid .metric span {
  font-size: 11px;
  line-height: 1.2;
}

.inventory-stats-grid .metric strong {
  margin-top: 4px;
  font-size: 15px;
}

.inventory-stats-grid .metric small {
  margin-top: 4px;
  font-size: 10px;
  line-height: 1.25;
}

.metric {
  padding: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

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

.metric strong {
  display: block;
  margin-top: 10px;
  font-size: 28px;
  line-height: 1;
  letter-spacing: 0;
}

.metric small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
}

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

.form-grid .span-2 {
  grid-column: 1 / -1;
}

.field-hint {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.form-note {
  margin-top: -6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.purchase-mode-panel {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
}

.purchase-inventory-fields {
  gap: 12px;
}

.settlement-bearing-row {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.evidence-field {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
}

.evidence-field label {
  display: grid;
  gap: 8px;
}

.file-field {
  margin: 0;
}

.inventory-calc {
  display: grid;
  gap: 6px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7fbf8;
  color: var(--muted);
  line-height: 1.5;
}

.inventory-calc strong {
  color: var(--ink);
}

.inventory-info {
  display: grid;
  gap: 3px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.inventory-info strong {
  color: var(--ink);
  font-size: 12px;
}

.inventory-mode-switch {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.field-title {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.info-note {
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f7faf8;
  padding: 11px 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.split-rule-list {
  display: grid;
  gap: 10px;
}

.split-rule-row {
  display: grid;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfb;
}

.split-rule-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
}

.split-rule-summary strong {
  display: block;
  color: var(--ink);
  font-size: 16px;
  line-height: 1.35;
}

.split-rule-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 0.85fr) minmax(0, 0.75fr);
  gap: 10px;
  align-items: end;
}

.split-rule-controls > * {
  min-width: 0;
}

.percent-input,
.computed-share {
  min-height: 44px;
}

.percent-input {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 24px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.percent-input input {
  border: 0;
  min-height: 42px;
}

.percent-input span {
  color: var(--muted);
  font-weight: 800;
}

.percent-input.is-readonly {
  background: #f8faf8;
}

.split-rule-actions {
  margin-top: 10px;
}

.split-rule-range {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.split-rule-remove {
  min-height: 36px;
  min-width: 72px;
}

.rule-help,
.rule-current {
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f7faf8;
  padding: 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.rule-help strong,
.rule-current {
  color: var(--ink);
  font-weight: 800;
}

.rule-help p {
  margin: 6px 0 0;
}

.computed-share {
  background: #f8faf8;
}

.computed-share strong {
  padding: 10px 11px;
  color: var(--ink);
  font-size: 16px;
  line-height: 1.25;
}

.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.checkbox-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  padding: 10px;
}

.checkbox-card input {
  width: auto;
  min-height: 0;
  margin-top: 3px;
}

.checkbox-card span,
.checkbox-card small {
  min-width: 0;
}

.checkbox-card strong,
.checkbox-card small {
  display: block;
}

.checkbox-card small {
  margin-top: 4px;
  color: var(--muted);
}

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

.btn {
  border: 1px solid var(--line-strong);
  background: #fff;
  color: var(--ink);
  border-radius: 6px;
  padding: 10px 13px;
  min-height: 40px;
  font-weight: 700;
}

.btn:hover,
.btn:focus-visible {
  border-color: var(--green);
  outline: none;
}

.btn.primary {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}

.btn.primary:hover,
.btn.primary:focus-visible {
  background: var(--green-dark);
  border-color: var(--green-dark);
}

.btn.ghost {
  background: transparent;
}

.btn.danger {
  border-color: rgba(184, 66, 66, 0.3);
  color: var(--danger);
}

.btn.small {
  min-height: 34px;
  padding: 7px 10px;
  font-size: 13px;
}

.panel-header .btn.primary[data-action^="new-"] {
  min-height: 30px;
  padding: 5px 8px;
  font-size: 13px;
}

.login-panel {
  min-height: calc(100vh - 170px);
  display: grid;
  place-items: center;
}

.login-card {
  width: min(420px, 100%);
  display: grid;
  gap: 18px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  padding: 28px;
  box-shadow: 0 18px 40px rgba(24, 38, 32, 0.08);
}

.login-card h3 {
  margin: 0 0 8px;
  font-size: 24px;
  line-height: 1.2;
  letter-spacing: 0;
}

.login-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 860px;
}

th,
td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 14px;
}

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

tr:last-child td {
  border-bottom: none;
}

.status,
.tag {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 800;
}

.status.pending {
  background: #fff4df;
  color: var(--amber);
}

.status.approved {
  background: #e6f4ee;
  color: var(--green);
}

.status.rejected {
  background: #faeaea;
  color: var(--danger);
}

.status.paid {
  background: #eaf0fa;
  color: var(--blue);
}

.status.unpaid {
  background: #f3f4f0;
  color: var(--muted);
}

.tag {
  background: var(--panel-soft);
  color: var(--ink);
  margin-right: 6px;
}

.empty {
  padding: 38px 20px;
  text-align: center;
  color: var(--muted);
}

.empty.compact {
  padding: 18px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  background: #fbfcfa;
}

.list {
  display: grid;
  gap: 10px;
}

.line-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.line-item:last-child {
  border-bottom: none;
}

.line-item h3 {
  margin: 0;
  font-size: 15px;
}

.line-item p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.amount {
  font-variant-numeric: tabular-nums;
  font-weight: 800;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.list-toolbar {
  justify-content: flex-start;
  min-height: 64px;
  padding-top: 12px;
  padding-bottom: 12px;
}

.split-list-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(120px, 160px)) auto;
  align-items: center;
  gap: 8px;
  width: min(620px, 100%);
}

.list-filter-input {
  min-height: 34px;
  height: 34px;
  padding: 7px 9px;
  font-size: 13px;
}

select.list-filter-input {
  padding-right: 28px;
  font-weight: 700;
}

.split-list-actions .btn {
  min-height: 34px;
  height: 34px;
  padding: 7px 10px;
}

.member-list-toolbar .split-list-actions {
  grid-template-columns: repeat(2, minmax(120px, 160px)) auto;
  width: min(500px, 100%);
}

.user-management-toolbar {
  align-items: center;
  justify-content: space-between;
}

.user-management-toolbar .split-list-actions {
  grid-template-columns: minmax(130px, 160px) minmax(130px, 160px) auto;
  width: min(500px, 100%);
}

.user-management-tabs {
  margin: 0;
  border-bottom: 0;
}

.role-permission-panel .permission-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: auto;
  padding: 0;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
}

.permission-toggle input {
  width: 14px;
  min-height: 14px;
  height: 14px;
  margin: 0;
}

.filter-panel {
  display: grid;
  gap: 14px;
  margin-bottom: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8faf7;
}

.compact-filter-panel {
  padding: 12px;
  overflow-x: auto;
}

.inline-filter-panel {
  display: grid;
  gap: 8px;
  margin: 0 0 12px;
  overflow-x: visible;
}

.period-filter-panel {
  position: relative;
  display: inline-block;
  margin: 0 0 12px;
  width: 190px;
  max-width: 100%;
  min-width: 0;
  justify-self: start;
}

.period-filter-panel summary {
  min-height: 34px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  list-style: none;
}

.period-filter-panel summary::-webkit-details-marker {
  display: none;
}

.period-filter-panel summary::after {
  content: "";
  width: 7px;
  height: 7px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
  margin-top: -3px;
}

.period-filter-panel[open] summary::after {
  transform: rotate(225deg);
  margin-top: 3px;
}

.period-filter-panel summary span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.period-filter-panel summary strong {
  color: var(--ink);
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.period-dropdown-menu {
  position: absolute;
  z-index: 30;
  top: calc(100% + 6px);
  left: 0;
  min-width: 220px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.period-option-list {
  display: grid;
  gap: 6px;
  max-height: 240px;
  overflow-y: auto;
}

.period-chip {
  display: flex;
  align-items: center;
  gap: 5px;
  min-height: 28px;
  padding: 4px 8px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.period-chip input {
  width: 13px;
  min-height: 13px;
  height: 13px;
  margin: 0;
  padding: 0;
}

.period-chip:has(input:checked) {
  border-color: var(--green);
  background: rgba(22, 118, 93, 0.09);
  color: var(--green-dark);
}

.expense-list-header {
  align-items: center;
  padding-top: 10px;
  padding-bottom: 10px;
  flex-wrap: wrap;
}

.expense-list-header .period-filter-panel {
  flex: 0 0 auto;
  margin: 0;
}

.expense-list-header .inline-filter-panel {
  flex: 1 1 760px;
  min-width: 0;
  margin: 0;
  padding: 8px 10px;
}

.inline-filter-panel .filter-compact-row {
  grid-template-columns: minmax(150px, 170px) minmax(220px, 1fr) repeat(4, minmax(118px, 145px));
  min-width: 0;
}

.inline-filter-panel .compact-filter select,
.inline-filter-panel .filter-search .search {
  min-height: 34px;
  padding: 7px 9px;
  font-size: 13px;
}

.period-compact-filter {
  gap: 6px;
}

.period-compact-filter .period-filter-panel {
  width: 100%;
  margin: 0;
}

.period-compact-filter .period-filter-panel summary {
  min-height: 34px;
  padding: 7px 9px;
  border-color: var(--line-strong);
}

.period-compact-filter .period-filter-panel summary span {
  display: none;
}

.period-compact-filter .period-filter-panel summary strong {
  font-size: 13px;
}

.inline-filter-panel .btn {
  min-height: 34px;
  padding: 7px 8px;
  font-size: 12px;
  white-space: nowrap;
}

.expense-list-header > .btn.primary,
.member-list-toolbar .btn.primary,
.user-management-toolbar .btn.primary {
  min-height: 34px;
  height: 34px;
  padding: 7px 10px;
  font-size: 13px;
  white-space: nowrap;
}

.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.inventory-table-toolbar {
  border-bottom: 1px solid var(--line);
}

.inventory-table-toolbar .tab-strip {
  flex: 1;
  margin: 0;
  border-bottom: 0;
}

.inventory-inline-filter,
.approval-inline-filter,
.settlement-inline-filter {
  grid-template-columns: repeat(3, minmax(130px, 170px));
  align-items: center;
  margin-bottom: 12px;
}

.approval-inline-filter {
  grid-template-columns: minmax(220px, 260px) repeat(3, minmax(130px, 170px));
}

.settlement-table-toolbar {
  align-items: center;
  flex-wrap: wrap;
}

.settlement-table-toolbar .settlement-inline-filter {
  margin: 0;
}

.settlement-table-toolbar .period-filter-panel {
  margin: 0;
}

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

.settlement-stats-grid .metric,
.ledger-panel .payment-summary-grid .metric {
  padding: 12px;
}

.settlement-stats-grid .metric strong,
.ledger-panel .payment-summary-grid .metric strong {
  margin-top: 6px;
  font-size: 20px;
}

.settlement-stats-grid .metric small,
.ledger-panel .payment-summary-grid .metric small {
  margin-top: 5px;
  font-size: 12px;
}

.settlement-table-toolbar > .btn,
.ledger-panel .panel-header .btn {
  min-height: 34px;
  padding: 7px 10px;
  font-size: 13px;
  white-space: nowrap;
}

.ledger-panel .compact-filter-panel {
  padding: 10px;
}

.ledger-panel .filter-compact-row {
  grid-template-columns: minmax(220px, 1fr) repeat(4, minmax(118px, 150px));
  min-width: 0;
}

.ledger-panel .compact-filter select,
.ledger-panel .filter-search .search {
  min-height: 34px;
  padding: 7px 9px;
  font-size: 13px;
}

.ledger-panel .compact-filter-panel .btn {
  min-height: 34px;
  padding: 7px 8px;
  font-size: 12px;
  white-space: nowrap;
}

.filter-compact-row {
  display: grid;
  grid-template-columns: minmax(260px, 1.5fr) repeat(4, minmax(124px, 0.7fr));
  gap: 10px;
  align-items: end;
  min-width: 820px;
}

.compact-filter {
  display: grid;
  gap: 6px;
  min-width: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.compact-filter select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-weight: 700;
}

.tab-strip {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 8px 0 14px;
  border-bottom: 1px solid var(--line);
}

.tab-button {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  min-height: 34px;
  padding: 6px 10px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
}

.tab-button small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.tab-button.is-active {
  color: var(--green);
  border-bottom-color: var(--green);
}

.filter-search-row {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  gap: 12px;
  align-items: end;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.filter-search .search {
  max-width: none;
}

.filter-group {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.filter-group-title {
  padding-top: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.filter-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
}

.filter-chip {
  min-height: 34px;
  padding: 7px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
}

.filter-chip:hover,
.filter-chip:focus-visible {
  border-color: var(--green);
  outline: none;
}

.filter-chip.is-active {
  border-color: var(--green);
  background: var(--green);
  color: #fff;
}

.filter-chip.is-active:hover,
.filter-chip.is-active:focus-visible {
  border-color: var(--green-dark);
  background: var(--green-dark);
}

.search {
  max-width: 320px;
}

.toast {
  position: fixed;
  right: 26px;
  top: 22px;
  min-width: 240px;
  max-width: 360px;
  padding: 12px 14px;
  border-radius: 8px;
  background: #18231e;
  color: #fff;
  box-shadow: var(--shadow);
  transform: translateY(-16px);
  opacity: 0;
  pointer-events: none;
  transition:
    transform 0.2s ease,
    opacity 0.2s ease;
  z-index: 10;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.settlement-total {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  background: #ecf4ef;
  border-bottom: 1px solid var(--line);
}

.settlement-total span {
  color: var(--muted);
  font-size: 13px;
}

.settlement-total strong {
  display: block;
  margin-top: 7px;
  font-size: 30px;
  letter-spacing: 0;
}

.chart-bars {
  display: grid;
  gap: 12px;
}

.bar-row {
  display: grid;
  grid-template-columns: 120px minmax(120px, 1fr) 110px;
  align-items: center;
  gap: 10px;
  font-size: 14px;
}

.bar-track {
  height: 10px;
  background: #e4e9e5;
  border-radius: 999px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  background: var(--green);
  border-radius: 999px;
}

.muted {
  color: var(--muted);
}

.voucher-block {
  display: grid;
  gap: 6px;
  margin-top: 6px;
}

.payment-info {
  display: grid;
  gap: 6px;
  min-width: 170px;
}

.payment-info-detail {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
}

.payment-info-detail p {
  margin: 0;
}

.file-list {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

.file-link {
  display: inline-flex;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 8px;
  color: var(--green);
  background: #f7fbf8;
  text-decoration: none;
  font-size: 12px;
  font-weight: 800;
}

.file-link:hover,
.file-link:focus-visible {
  border-color: var(--green);
  outline: none;
}

.right {
  text-align: right;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  display: flex;
  justify-content: flex-end;
  background: rgba(20, 29, 25, 0.42);
  z-index: 30;
}

.modal-panel {
  width: min(760px, 100vw);
  height: 100vh;
  overflow-y: auto;
  background: var(--panel);
  box-shadow: -24px 0 50px rgba(20, 29, 25, 0.18);
}

.modal-panel.form-modal {
  width: min(840px, 100vw);
}

.modal-panel.settlement-modal {
  width: min(980px, 100vw);
}

.modal-panel.settlement-print-modal {
  width: min(1120px, 100vw);
}

.modal-panel.inventory-detail-modal {
  width: min(980px, 100vw);
}

.modal-header {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  padding: 20px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.modal-header h3 {
  margin: 0;
  font-size: 22px;
}

.modal-header p:not(.eyebrow) {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.modal-body {
  display: grid;
  gap: 18px;
  padding: 20px;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.settlement-detail-grid {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.detail-item {
  min-height: 72px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
}

.detail-item span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 8px;
}

.detail-item strong {
  display: block;
  font-size: 15px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.detail-section {
  display: grid;
  gap: 8px;
  padding-top: 6px;
}

.detail-section h4 {
  margin: 0;
  font-size: 16px;
}

.detail-section p {
  margin: 0;
  color: var(--ink);
  line-height: 1.6;
}

.type-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.type-summary-card {
  min-height: 86px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
}

.type-summary-card span,
.type-summary-card small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.type-summary-card strong {
  display: block;
  margin: 8px 0 6px;
  font-size: 20px;
  line-height: 1;
}

.detail-table {
  min-width: 920px;
}

.print-modal-body {
  background: #eef2ef;
}

.print-sheet {
  display: grid;
  gap: 18px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.print-sheet-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  padding-bottom: 18px;
  border-bottom: 2px solid var(--ink);
}

.print-sheet-header p {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.print-sheet-header h3 {
  margin: 0;
  font-size: 28px;
  line-height: 1.1;
}

.print-status {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 7px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #f8faf7;
  font-size: 13px;
  font-weight: 800;
}

.print-meta-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.print-meta-item {
  min-height: 66px;
  padding: 11px 12px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.print-meta-item:nth-child(3n) {
  border-right: none;
}

.print-meta-item:nth-last-child(-n + 3) {
  border-bottom: none;
}

.print-meta-item span {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 12px;
}

.print-meta-item strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: 15px;
}

.print-total-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.print-total-card {
  min-height: 98px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8faf7;
}

.print-total-card span,
.print-total-card small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.print-total-card strong {
  display: block;
  margin: 10px 0 8px;
  font-size: 24px;
  line-height: 1;
}

.print-section {
  display: grid;
  gap: 8px;
}

.print-section h4 {
  margin: 0;
  font-size: 16px;
}

.print-table {
  min-width: 0;
  border: 1px solid var(--line);
}

.print-table th,
.print-table td {
  font-size: 12px;
  line-height: 1.45;
}

.print-table tfoot td {
  background: #f7f9f6;
  font-weight: 800;
}

.compact-table {
  width: min(520px, 100%);
}

.signature-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding-top: 14px;
}

.signature-grid div {
  min-height: 72px;
  padding-top: 10px;
  border-top: 1px solid var(--line-strong);
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

@media (max-width: 1080px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    padding: 18px;
  }

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

  .side-note {
    display: none;
  }

  .metric-grid,
  .payment-summary-grid,
  .grid.three,
  .grid.two,
  .checkbox-grid,
  .settlement-detail-grid,
  .type-summary-grid,
  .print-meta-grid,
  .print-total-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .print-meta-item:nth-child(3n) {
    border-right: 1px solid var(--line);
  }

  .print-meta-item:nth-child(2n) {
    border-right: none;
  }

  .print-meta-item:nth-last-child(-n + 3) {
    border-bottom: 1px solid var(--line);
  }

  .print-meta-item:nth-last-child(-n + 2) {
    border-bottom: none;
  }
}

@media (max-width: 720px) {
  .workspace {
    padding: 18px;
  }

  .topbar,
  .panel-header,
  .settlement-total {
    display: grid;
  }

  .top-actions,
  .top-actions label,
  .top-actions .env-badge,
  .top-actions .auth-badge,
  .top-actions .btn {
    width: 100%;
  }

  .nav-list,
  .metric-grid,
  .payment-summary-grid,
  .grid.three,
  .grid.two,
  .checkbox-grid,
  .form-grid,
  .detail-grid,
  .type-summary-grid,
  .print-meta-grid,
  .print-total-grid,
  .signature-grid {
    grid-template-columns: 1fr;
  }

  .split-rule-row,
  .split-rule-summary,
  .split-rule-controls {
    grid-template-columns: 1fr;
  }

  .split-rule-range {
    text-align: left;
  }

  .print-sheet,
  .print-modal-body {
    padding: 16px;
  }

  .print-sheet-header {
    display: grid;
  }

  .print-meta-item,
  .print-meta-item:nth-child(2n),
  .print-meta-item:nth-child(3n) {
    border-right: none;
  }

  .print-meta-item:nth-last-child(-n + 2) {
    border-bottom: 1px solid var(--line);
  }

  .print-meta-item:last-child {
    border-bottom: none;
  }

  .filter-search-row,
  .filter-group {
    grid-template-columns: 1fr;
  }

  .filter-search-row .btn {
    width: 100%;
  }

  .filter-group-title {
    padding-top: 0;
  }

  .form-grid .span-2 {
    grid-column: auto;
  }

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

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

@media print {
  @page {
    margin: 12mm;
    size: A4;
  }

  body {
    background: #fff;
  }

  .sidebar,
  .topbar,
  .toast,
  .view > :not(.print-backdrop),
  .print-toolbar {
    display: none !important;
  }

  .app-shell,
  .workspace,
  .view {
    display: block;
    min-height: 0;
    padding: 0;
  }

  .print-backdrop {
    position: static;
    display: block;
    background: #fff;
  }

  .settlement-print-modal {
    width: 100%;
    height: auto;
    overflow: visible;
    box-shadow: none;
  }

  .print-modal-body {
    display: block;
    padding: 0;
    background: #fff;
  }

  .print-sheet {
    padding: 0;
    border: none;
    border-radius: 0;
  }

  .print-sheet-header h3 {
    font-size: 24px;
  }

  .print-meta-grid,
  .print-total-grid {
    break-inside: avoid;
  }

  .print-table {
    width: 100%;
    page-break-inside: auto;
  }

  .print-table tr {
    page-break-inside: avoid;
  }

  .print-table th,
  .print-table td {
    padding: 7px 6px;
    font-size: 10px;
  }

  .signature-grid {
    break-inside: avoid;
  }
}
