:root {
  --bg: #f5f7f8;
  --bg-strong: #e9eef0;
  --panel: #ffffff;
  --panel-soft: #f9fbfb;
  --ink: #101820;
  --muted: #5f6d75;
  --line: #dbe3e6;
  --line-strong: #c7d1d6;
  --accent: #17664d;
  --accent-dark: #0f4736;
  --accent-soft: #e6f2ed;
  --warn: #9a5b12;
  --bad: #b42318;
  --good: #157347;
  --info: #235a97;
  --shadow-sm: 0 1px 2px rgba(16, 24, 32, 0.06);
  --shadow-md: 0 12px 32px rgba(16, 24, 32, 0.08);
  --radius: 8px;
  --ease: cubic-bezier(.22, 1, .36, 1);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(255,255,255,.65), rgba(245,247,248,0) 280px),
    var(--bg);
  font-family: "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.55;
}
a { color: var(--accent-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
.skip-link {
  position: fixed;
  left: 16px;
  top: 12px;
  z-index: 50;
  padding: 8px 12px;
  border-radius: 6px;
  background: var(--ink);
  color: #fff;
  transform: translateY(-140%);
}
.skip-link:focus { transform: translateY(0); }
.page-loading-indicator {
  position: fixed;
  top: 74px;
  left: 50%;
  z-index: 80;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid rgba(15, 71, 54, 0.16);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.96);
  color: var(--accent-dark);
  box-shadow: 0 10px 30px rgba(16, 24, 32, 0.12);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -8px);
  transition: opacity 160ms var(--ease), transform 160ms var(--ease);
}
.page-loading-indicator.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}
.page-loading-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(23, 102, 77, 0.18);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: page-loading-spin 800ms linear infinite;
}
@keyframes page-loading-spin {
  to { transform: rotate(360deg); }
}
.app-shell,
.shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;
}
.topbar {
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 10px 28px;
  background: #0f241d;
  color: white;
  border-bottom: 3px solid #d7b15a;
}
.brand-block { display: grid; gap: 2px; }
.brand { font-weight: 800; letter-spacing: 0; }
.nav { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.nav a {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  padding: 0 9px;
  border-radius: 6px;
  color: #edf7f2;
}
.nav a:hover { background: rgba(255,255,255,.08); text-decoration: none; }
.user-chip {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  padding: 0 9px;
  border-radius: 999px;
  background: rgba(255,255,255,.1);
  color: #fff;
  font-weight: 700;
}
.supplier-mobile-account {
  display: none;
}
.container { width: min(1240px, calc(100vw - 40px)); min-width: 0; margin: 28px auto 56px; }
.role-admin .container,
.role-finance .container,
.role-finance_manager .container {
  width: min(1440px, calc(100vw - 40px));
}
.page-stack { display: grid; gap: 16px; min-width: 0; }
.page-heading {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
}
.page-heading h1 {
  margin: 0 0 6px;
  font-size: 30px;
  line-height: 1.2;
}
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow-sm);
  min-width: 0;
}
.panel h1, .panel h2, .panel h3 { margin: 0 0 12px; }
.panel h2 { font-size: 20px; }
.panel h3 { font-size: 16px; }
.muted { color: var(--muted); }
.metric-grid,
.grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}
.admin-workbench > .metric-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
.metric-card {
  display: grid;
  gap: 6px;
  min-height: 126px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow-sm);
}
.metric-card-accent { background: linear-gradient(180deg, #ffffff, #f4faf7); border-color: #cfe1d9; }
.metric-link-card {
  color: var(--ink);
  text-decoration: none;
}
.metric-link-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
  text-decoration: none;
}
.metric-label { color: var(--muted); font-weight: 800; font-size: 13px; }
.metric { font-size: 32px; font-weight: 900; line-height: 1.1; letter-spacing: 0; }
.metric-note { color: var(--muted); font-size: 13px; }
.bill-detail-summary {
  margin-top: 14px;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
}
.bill-detail-summary .metric-card {
  min-height: 84px;
  padding: 14px 16px;
  align-content: center;
  box-shadow: none;
}
.bill-detail-summary .metric {
  font-size: 28px;
}
.bill-detail-summary .metric-note {
  color: var(--ink);
  font-size: 16px;
  font-weight: 800;
}
.bill-detail-merge-note {
  margin: -4px 0 12px;
  color: var(--warn);
  font-size: 13px;
  font-weight: 800;
}
.diff-value-alert {
  color: var(--bad);
  font-weight: 900;
}
.operations-panel { display: grid; gap: 14px; }
.workbench-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  align-items: start;
}
.action-panel {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
}
.accounting-settings-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
}
.accounting-settings-panel h2 {
  margin-bottom: 6px;
}
.accounting-settings-panel p {
  max-width: 72ch;
  margin: 0;
}
.accounting-settings-form {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
}
.accounting-settings-form .btn {
  min-height: 40px;
  padding-inline: 12px;
}
.accounting-cutoff-card {
  min-height: 148px;
  align-content: start;
}
.accounting-cutoff-card .metric-note {
  margin-top: auto;
}
.cutoff-time-picker {
  position: relative;
  display: block;
  min-width: 0;
}
.cutoff-time-trigger {
  width: 100%;
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  padding: 8px 10px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}
.cutoff-time-trigger:hover,
.cutoff-time-trigger:focus-visible,
.cutoff-time-trigger[aria-expanded="true"] {
  border-color: var(--accent);
  outline: 3px solid rgba(23, 102, 77, .16);
  outline-offset: 1px;
}
.cutoff-time-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 28;
  width: 184px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 42px rgba(16, 24, 32, 0.16);
}
.cutoff-time-column {
  display: grid;
  gap: 6px;
}
.cutoff-time-column-title {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-align: center;
}
.cutoff-time-options {
  display: grid;
  gap: 3px;
  max-height: 184px;
  overflow-y: auto;
  padding-right: 2px;
}
.cutoff-time-option {
  min-height: 30px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.cutoff-time-option:hover,
.cutoff-time-option:focus-visible {
  background: #edf3ef;
  outline: none;
}
.cutoff-time-option.is-selected {
  background: var(--accent);
  color: #fff;
}
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.btn {
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 10px 14px;
  background: var(--accent);
  color: white;
  cursor: pointer;
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font: inherit;
  font-weight: 800;
  transition: background 180ms var(--ease), border-color 180ms var(--ease), box-shadow 180ms var(--ease), transform 180ms var(--ease);
}
.btn:hover { background: var(--accent-dark); text-decoration: none; }
.btn:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(23, 102, 77, .24);
  outline-offset: 2px;
}
.btn:active { transform: translateY(1px); }
.btn.secondary { background: #edf2ef; color: var(--ink); border-color: var(--line); }
.btn.secondary:hover { background: #e3ebe7; }
.btn.danger { background: #c75245; color: white; }
.btn.danger:hover { background: #9f372d; }
.btn:disabled { cursor: wait; opacity: 0.72; transform: none; }
.btn.compact { min-height: 36px; padding: 7px 12px; }
.search-bar {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr)) auto auto;
  gap: 10px;
  align-items: end;
  margin: 14px 0;
}
.search-bar-wide {
  grid-template-columns: repeat(3, minmax(180px, 1fr)) auto auto;
}
.search-bar-bills {
  grid-template-columns: minmax(150px, .7fr) minmax(150px, .7fr) minmax(240px, 1.1fr) minmax(240px, 1.1fr) auto auto;
}
.search-bar label {
  display: block;
  margin: 0 0 6px;
  font-weight: 900;
}
.search-bar input,
.search-bar select,
.search-bar textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid #cfdcd6;
  border-radius: 6px;
  padding: 9px 11px;
  font: inherit;
  background: #fff;
}
.search-bar textarea {
  min-height: 96px;
  resize: vertical;
}
.search-batch-panel {
  grid-column: 1 / -1;
}
.admin-bills-page {
  display: grid;
  gap: 14px;
}
.admin-bills-filter-panel {
  padding: 16px;
}
.admin-bills-filter-grid {
  display: grid;
  grid-template-columns: minmax(142px, .62fr) minmax(142px, .62fr) minmax(220px, 1fr) minmax(210px, .9fr) auto;
  gap: 10px;
  align-items: end;
}
.admin-bills-filter-label {
  min-width: 0;
  gap: 6px;
}
.admin-bills-filter-grid input {
  width: 100%;
  height: 40px;
  min-height: 40px;
  padding: 8px 10px;
  font-size: 14px;
}
.admin-bills-filter-grid input[type="hidden"] {
  display: none;
}
.supplier-picker-trigger {
  width: 100%;
  height: 40px;
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid #cfdcd6;
  border-radius: 6px;
  padding: 8px 10px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  font-size: 14px;
  text-align: left;
}
.supplier-picker-trigger:hover,
.supplier-picker-trigger:focus-visible,
.supplier-picker-trigger[aria-expanded="true"] {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(23, 102, 77, .12);
}
.supplier-picker-trigger span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.confirm-dialog.supplier-picker-dialog {
  width: min(720px, calc(100vw - 40px));
  max-height: calc(100vh - 72px);
  display: grid;
  gap: 14px;
  overflow: hidden;
}
.supplier-picker-dialog .dialog-heading-row {
  margin-bottom: 0;
}
.supplier-picker-search {
  width: 100%;
  min-height: 40px;
  border: 1px solid #cfdcd6;
  border-radius: 6px;
  padding: 9px 11px;
  font: inherit;
}
.supplier-picker-list {
  display: grid;
  gap: 6px;
  max-height: min(420px, calc(100vh - 260px));
  overflow: auto;
  padding-right: 4px;
}
.supplier-picker-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 11px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  text-align: left;
}
.supplier-picker-option:hover,
.supplier-picker-option:focus-visible {
  border-color: #b8cac2;
  background: #f7fbf9;
}
.supplier-picker-option.is-selected {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.supplier-picker-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 900;
}
.supplier-picker-meta {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}
.supplier-picker-empty {
  min-height: 80px;
  display: grid;
  place-items: center;
  border: 1px dashed var(--line-strong);
  border-radius: 6px;
  background: #fafcfb;
  font-weight: 800;
}
.admin-bills-filter-label span {
  color: #16241d;
  font-size: 14px;
  font-weight: 900;
  line-height: 1.2;
}
.admin-bills-date-picker .date-picker-trigger {
  height: 40px;
  min-height: 40px;
  font-size: 14px;
  letter-spacing: 0;
}
.admin-bills-date-picker .date-picker-panel {
  width: 316px;
}
.admin-bills-date-picker .date-picker-footer {
  justify-content: flex-end;
}
.admin-bills-date-picker .date-picker-link {
  min-width: 46px;
  text-align: center;
}
.admin-bills-date-picker .date-picker-trigger span:first-child {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
}
.admin-bills-filter-actions {
  display: flex;
  align-items: end;
  gap: 8px;
  justify-content: flex-end;
}
.admin-bills-filter-actions .btn {
  height: 40px;
  min-height: 40px;
}
.admin-bills-table-panel {
  display: grid;
  gap: 12px;
}
.admin-bills-result-heading h2 {
  margin: 0 0 4px;
  font-size: 20px;
}
.admin-bills-table th:nth-child(4),
.admin-bills-table td:nth-child(4),
.admin-bills-table th:nth-child(5),
.admin-bills-table td:nth-child(5) {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.table-wrap {
  overflow-x: auto;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}
table { width: 100%; border-collapse: collapse; background: white; }
.data-table th,
.data-table td,
th,
td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
  vertical-align: middle;
}
.role-admin .data-table th,
.role-admin .data-table td,
.role-finance .data-table th,
.role-finance .data-table td {
  white-space: nowrap;
}
.data-table th,
th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #edf3ef;
  font-weight: 900;
  color: #17211b;
}
.data-table tbody tr:hover td { background: #fafcfb; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.table-link { font-weight: 800; }
.history-row-actions { margin: 0; }
.history-row-actions .btn.compact {
  min-height: 30px;
  padding: 5px 9px;
}
.inline-link-button {
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--green);
  font: inherit;
  font-weight: 900;
  cursor: pointer;
  user-select: text;
  white-space: nowrap;
}
.inline-link-button:hover,
.inline-link-button:focus-visible {
  text-decoration: underline;
}
.bill-line-with-related-inbounds td {
  border-bottom: 0;
}
.related-inbound-row td {
  background: #f8fbfa;
  padding-top: 0;
}
.related-inbound-row:hover td {
  background: #f8fbfa !important;
}
.related-inbound-group {
  border-left: 3px solid #cddbd3;
  padding: 8px 0 8px 14px;
}
.related-inbound-title {
  margin-bottom: 8px;
  color: #56635c;
  font-size: 13px;
  font-weight: 900;
}
.related-inbound-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: #56635c;
  font-size: 13px;
  font-weight: 900;
}
.related-toggle {
  min-height: 32px;
  padding: 0 12px;
}
.related-inbound-panel {
  margin-top: 8px;
}
.related-inbound-empty {
  border-left: 3px solid #d7dfda;
  padding: 8px 0 8px 14px;
  color: #7c8881;
  font-weight: 700;
}
.nested-data-table {
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
  background: #fff;
}
.nested-data-table th,
.nested-data-table td {
  padding: 8px 10px;
  font-size: 13px;
  border-bottom: 1px solid var(--line);
}
.nested-data-table th {
  background: #eef4f0;
}
.nested-data-table tr:last-child td {
  border-bottom: 0;
}
.inbound-modal-host td {
  height: 0;
  padding: 0;
  border: 0;
}
.inbound-line-dialog {
  width: min(1040px, calc(100vw - 48px));
  max-height: calc(100vh - 80px);
  overflow: auto;
}
.dialog-heading-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.dialog-close-button {
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #f7faf8;
  color: var(--ink);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}
.modal-subtitle {
  margin-bottom: 14px;
  color: var(--muted);
  font-weight: 800;
}
.modal-table-wrap {
  max-height: calc(100vh - 220px);
}
.row-FAIL td { background: #fff6f5; }
.row-REVIEW td { background: #fffaf0; }
.row-PASS td { background: #f7fcf9; }
.status {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
}
.status.PASS { background: #dff3e8; color: var(--good); }
.status.FAIL { background: #fde2df; color: var(--bad); }
.status.REVIEW, .status.RUNNING { background: #fff2d6; color: var(--warn); }
.status.SUBMITTED { background: #e3eefc; color: var(--info); }
.status.MAPPING_SINGLE { background: #e6f2ff; color: #1766a6; }
.status.MAPPING_MULTI { background: #f1e9ff; color: #6f3fb5; }
.status.MAPPING_INACTIVE { background: #eceff3; color: #687481; }
.form-grid { display: grid; grid-template-columns: repeat(5, minmax(120px, 1fr)); gap: 10px; }
label { display: grid; gap: 6px; font-weight: 800; color: #2e3a33; }
input, select, textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  padding: 9px 10px;
  font: inherit;
  background: white;
  color: var(--ink);
}
input::placeholder { color: #7a8790; opacity: 1; }
textarea { min-height: 76px; }
.adjust-form {
  display: grid;
  gap: 8px;
  min-width: 220px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}
.fixed-code,
.fixed-id,
.readonly-value,
.supplier-name-value {
  display: inline-flex;
  align-items: center;
  width: 100%;
  min-height: 40px;
  padding: 0 10px;
  border-radius: 6px;
  background: #edf3ef;
  font-weight: 900;
  color: var(--accent-dark);
}
.fixed-id { color: var(--ink); font-weight: 800; }
.readonly-value {
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  font-weight: 800;
}
.supplier-name-value {
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  font-weight: 900;
}
.state-pill {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 10px;
  border-radius: 999px;
  font-weight: 900;
}
.state-pill.enabled { background: #eef1f4; color: #24303a; }
.state-pill.disabled { background: #f4ece8; color: #9f372d; }
.page-heading + .message,
.page-heading + .error { margin-top: 0; }
.error,
.message {
  padding: 12px 14px;
  border-radius: 6px;
  margin-bottom: 14px;
  font-weight: 800;
}
.error { border: 1px solid #f0b4ad; background: #fff0ee; color: var(--bad); }
.message { border: 1px solid #9fd6bb; background: #e8f8ef; color: var(--good); }
.message.is-dismissing {
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.22s ease, transform 0.22s ease;
}
.supplier-management { display: grid; gap: 14px; }
.account-management-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}
.account-summary-strip {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.account-summary-strip > div {
  min-width: 124px;
  min-height: 44px;
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}
.account-summary-strip strong {
  font-size: 22px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.account-summary-strip span {
  color: var(--muted);
  font-weight: 800;
}
.account-tabs {
  display: inline-flex;
  width: fit-content;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #edf2ef;
}
.account-tabs button {
  min-height: 36px;
  padding: 0 14px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-weight: 900;
}
.account-tabs button[aria-selected="true"] {
  background: #fff;
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}
.account-create-dialog {
  position: relative;
  width: min(480px, 100%);
}
.finance-create-dialog {
  width: min(480px, 100%);
}
.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
}
.modal-close:hover { background: #f3f6f5; }
.account-create-dialog .supplier-create-form {
  grid-template-columns: 1fr;
  margin-top: 14px;
}
.account-create-dialog .account-create-form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-top: 14px;
}
.custom-select-field {
  position: relative;
  display: grid;
  gap: 6px;
}
.custom-select-label {
  font-weight: 800;
  color: #2e3a33;
}
.custom-select-trigger {
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  font-weight: 900;
  text-align: left;
}
.custom-select-trigger:hover,
.custom-select-trigger:focus-visible {
  border-color: #99b8ad;
  box-shadow: 0 0 0 3px rgba(23, 102, 77, 0.12);
  outline: none;
}
.custom-select-arrow {
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
}
.custom-select-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 95;
  display: grid;
  gap: 4px;
  padding: 6px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow-md);
}
.custom-select-option {
  min-height: 40px;
  padding: 8px 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  font-weight: 800;
  text-align: left;
}
.custom-select-option:hover,
.custom-select-option:focus-visible {
  background: #eef5f1;
  outline: none;
}
.custom-select-option.is-selected {
  background: var(--accent);
  color: #fff;
}
.account-create-dialog .btn {
  width: 100%;
  align-self: end;
  white-space: normal;
}
.management-forms {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(300px, 0.75fr);
  gap: 14px;
}
.subpanel {
  margin: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
}
.subpanel h2 { font-size: 18px; margin: 0 0 10px; }
.supplier-create-form,
.account-create-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(150px, 1fr));
  gap: 10px;
  align-items: end;
}
.management-forms .account-create-form { grid-template-columns: 1fr; }
.submit-hint {
  grid-column: 1 / -1;
  padding: 10px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #f8fafc;
  color: #334155;
  font-weight: 800;
}
.submit-hint[hidden] { display: none; }
.supplier-list { display: grid; gap: 14px; }
.finance-account-panel {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}
.finance-account-panel .section-row-heading {
  align-items: flex-start;
}
.finance-account-panel h2,
.account-section-title h2 {
  margin: 0 0 4px;
  font-size: 18px;
}
.finance-account-panel p,
.account-section-title p {
  margin: 0;
}
.account-section-title {
  padding-top: 4px;
}
.supplier-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.supplier-card-main {
  display: grid;
  grid-template-columns: minmax(360px, 1.45fr) minmax(180px, 0.65fr) auto auto;
  gap: 14px;
  align-items: end;
  padding: 14px;
  background: #fbfcfd;
}
.supplier-identity,
.supplier-meta,
.supplier-status,
.supplier-actions { display: grid; gap: 8px; }
.supplier-title {
  display: grid;
  grid-template-columns: 1fr;
}
.eyebrow,
.field-label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}
.supplier-status,
.supplier-actions {
  grid-auto-flow: column;
  align-items: center;
  justify-content: end;
}
.supplier-accounts {
  display: grid;
  gap: 10px;
  padding: 14px;
  border-top: 1px solid var(--line);
}
.section-row-heading {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}
.section-row-heading h3 { margin: 0; font-size: 16px; }
.token-settings-shell {
  max-width: 860px;
  margin: 0 auto;
}
.token-settings-panel {
  display: grid;
  gap: 18px;
  padding: 24px;
}
.token-settings-heading {
  align-items: flex-start;
}
.token-settings-heading h1 {
  font-size: 28px;
  line-height: 1.2;
  margin-bottom: 8px;
}
.token-settings-heading p {
  margin: 0;
}
.token-status-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
  align-items: center;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}
.token-status-card > div {
  display: grid;
  gap: 6px;
  min-width: 0;
}
.token-status-card strong {
  overflow-wrap: anywhere;
}
.token-source-pill {
  justify-self: start;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 13px;
  line-height: 1.2;
}
.token-source-manual {
  color: var(--brand);
  background: #e9f6f1;
}
.token-source-env {
  color: #355d9b;
  background: #edf4ff;
}
.token-source-missing {
  color: var(--muted);
  background: #eef1f4;
}
.token-settings-form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  max-width: 640px;
}
.token-settings-form label {
  display: grid;
  gap: 6px;
  font-weight: 700;
}
.token-settings-form input {
  width: 100%;
}
.token-settings-actions {
  display: flex;
  justify-content: flex-start;
}
.line-detail-heading {
  margin-bottom: 12px;
  align-items: end;
  flex-wrap: wrap;
}
.line-status-filter {
  display: flex;
  align-items: end;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}
.line-status-filter label {
  font-weight: 900;
  color: var(--muted);
}
.line-status-filter select {
  min-height: 36px;
  min-width: 138px;
  border: 1px solid #cfdcd6;
  border-radius: 6px;
  padding: 7px 10px;
  background: #fff;
  font: inherit;
}
.line-status-header-filter {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.line-status-dropdown { display: inline-flex; }
.line-status-dropdown-trigger {
  min-height: 32px;
  min-width: 88px;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  cursor: pointer;
  border: 1px solid #bfd0c8;
  border-radius: 6px;
  padding: 5px 8px 5px 10px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-weight: 800;
  box-shadow: 0 1px 0 rgba(16, 24, 32, 0.03);
  transition: background 160ms var(--ease), border-color 160ms var(--ease), box-shadow 160ms var(--ease);
}
.line-status-dropdown-trigger:hover,
.line-status-dropdown-trigger:focus-visible,
.line-status-dropdown.is-open .line-status-dropdown-trigger {
  border-color: var(--accent);
  background: #f8fbfa;
  outline: none;
}
.line-status-dropdown-chevron {
  color: var(--muted);
  font-size: 15px;
  line-height: 1;
}
.line-status-dropdown-menu {
  position: fixed;
  z-index: 40;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 112px;
  padding: 5px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 16px 34px rgba(16, 24, 32, 0.18);
}
.line-status-dropdown-menu button {
  width: 100%;
  min-height: 34px;
  border: 0;
  border-radius: 6px;
  padding: 7px 10px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  font-weight: 800;
  text-align: left;
}
.line-status-dropdown-menu button:hover,
.line-status-dropdown-menu button:focus-visible {
  background: #edf3ef;
  outline: none;
}
.line-status-dropdown-menu button.is-selected {
  background: var(--accent-soft);
  color: var(--accent-dark);
}
.line-action-group {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}
.line-resolution-dialog {
  width: min(480px, calc(100vw - 40px));
}
.line-resolution-dialog form {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}
.line-resolution-dialog label {
  display: grid;
  gap: 6px;
  color: var(--ink);
  font-weight: 900;
}
.line-resolution-dialog select,
.line-resolution-dialog textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}
.line-resolution-dialog select {
  min-height: 38px;
  padding: 7px 10px;
}
.line-resolution-dialog textarea {
  min-height: 96px;
  padding: 9px 10px;
  resize: vertical;
}
.modal-loading-note {
  padding: 18px;
  color: var(--muted);
  font-weight: 800;
}
.account-table { display: grid; gap: 8px; }
.supplier-account-row {
  display: grid;
  grid-template-columns: minmax(160px, 0.8fr) minmax(260px, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}
.account-name,
.account-main,
.account-actions,
.inline-password-form {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.account-name {
  min-width: 0;
  align-items: flex-start;
  flex-direction: column;
}
.account-title-line,
.account-meta-line {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.account-meta-line {
  color: var(--muted);
  font-size: 13px;
}
.account-state {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
}
.account-state.enabled { background: #eef1f4; color: #24303a; }
.account-state.disabled { background: #f4ece8; color: #9f372d; }
.account-role-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: #edf7f2;
  color: #17633f;
  font-size: 12px;
  font-weight: 900;
}
.inline-password-form input { width: 150px; min-height: 36px; padding: 7px 9px; }
.empty-row {
  padding: 14px;
  border: 1px dashed var(--line-strong);
  border-radius: 6px;
  background: #fbfcfd;
}
.password-panel {
  max-width: 680px;
  margin: 0 auto;
}
.password-form {
  display: grid;
  gap: 12px;
  max-width: 420px;
}
.password-input-wrap {
  position: relative;
  display: block;
}
.supplier-home-simple {
  max-width: 760px;
  margin: 0 auto;
}
.supplier-entry-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}
.supplier-entry-card {
  display: grid;
  gap: 8px;
  min-height: 132px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  color: var(--ink);
  text-decoration: none;
  transition: border-color 180ms var(--ease), box-shadow 180ms var(--ease), transform 180ms var(--ease);
}
.supplier-entry-card:hover,
.supplier-entry-card:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 12px 28px rgba(16, 24, 32, 0.08);
  outline: none;
  text-decoration: none;
  transform: translateY(-1px);
}
.supplier-entry-card strong {
  font-size: 22px;
}
.supplier-entry-card span {
  color: var(--muted);
  line-height: 1.6;
}
.supplier-entry-card.primary {
  background: #f2f8f5;
  border-color: #c8ded4;
}
.month-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin: 14px 0 16px;
}
.month-summary-card {
  display: grid;
  gap: 6px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}
.month-summary-card strong {
  color: var(--accent-dark);
  font-size: 22px;
  font-variant-numeric: tabular-nums;
}
.mapping-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin: 14px 0 16px;
}
.mapping-summary-card {
  display: grid;
  gap: 6px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
}
.mapping-summary-card strong {
  color: var(--accent-dark);
  font-size: 28px;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.mapping-detail-heading {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  gap: 16px;
  align-items: end;
  margin-bottom: 14px;
}
.mapping-detail-heading h2 {
  margin-bottom: 4px;
}
.mapping-filter-form {
  display: grid;
  grid-template-columns: minmax(180px, 240px) minmax(140px, 180px) auto;
  gap: 10px;
  align-items: end;
}
.mapping-detail-lines summary {
  cursor: pointer;
  color: var(--green);
  font-weight: 900;
}
.mapping-item-detail-row > td {
  padding: 0 10px 14px;
  background: #fbfdfc;
}
.mapping-detail-line-table {
  margin-top: 10px;
  min-width: 980px;
}
.mapping-line-actions {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  flex-wrap: wrap;
}
.mapping-line-actions details {
  position: relative;
}
.mapping-line-actions summary {
  list-style: none;
}
.mapping-line-actions summary::-webkit-details-marker {
  display: none;
}
.mapping-edit-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(160px, 1fr));
  gap: 10px;
  min-width: min(520px, 80vw);
  margin-top: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow-sm);
}
.mapping-edit-form label {
  display: grid;
  gap: 5px;
  font-size: 12px;
  color: var(--muted);
}
.mapping-edit-form input {
  min-height: 34px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
}
.mapping-edit-form .btn {
  align-self: end;
}
.supplier-history-filter {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 260px)) auto auto;
  align-items: end;
  gap: 12px;
  margin: 14px 0 16px;
}
.supplier-history-filter-month {
  width: min(680px, 100%);
  grid-template-columns: minmax(220px, 280px) auto;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  box-shadow: var(--shadow-sm);
}
.supplier-history-actions {
  justify-self: end;
  display: flex;
  align-items: end;
  gap: 8px;
  flex-wrap: wrap;
}
.supplier-history-filter label {
  display: grid;
  gap: 6px;
  font-weight: 700;
}
.supplier-history-filter input[type="date"],
.supplier-history-filter input[type="month"] {
  width: 100%;
}
.month-picker {
  position: relative;
  display: block;
}
.month-picker-trigger {
  width: 100%;
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  padding: 9px 10px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  font-weight: 900;
  text-align: left;
}
.month-picker-trigger:hover,
.month-picker-trigger:focus-visible,
.month-picker-trigger[aria-expanded="true"] {
  border-color: var(--accent);
  outline: 3px solid rgba(23, 102, 77, .16);
  outline-offset: 1px;
}
.month-picker-icon {
  color: var(--muted);
  font-size: 13px;
}
.month-picker-panel {
  position: absolute;
  left: 0;
  top: calc(100% + 6px);
  z-index: 20;
  width: 292px;
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 42px rgba(16, 24, 32, 0.16);
}
.month-picker-heading,
.month-picker-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.month-picker-heading {
  margin-bottom: 0;
}
.month-picker-heading strong {
  font-size: 16px;
  font-weight: 900;
}
.month-picker-nav,
.month-picker-link,
.month-picker-option,
.month-picker-title,
.month-picker-year-option {
  border: 0;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font: inherit;
}
.month-picker-title {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: 6px;
  padding: 0 10px;
  font-weight: 900;
}
.month-picker-nav {
  width: 34px;
  height: 34px;
  border-radius: 6px;
  font-size: 24px;
  line-height: 1;
}
.month-picker-year-list {
  display: grid;
  gap: 3px;
  max-height: 156px;
  overflow-y: auto;
  margin: 0;
  padding: 2px 0 8px;
  border-bottom: 1px solid var(--line);
}
.month-picker-year-option {
  min-height: 30px;
  border-radius: 6px;
  padding: 0 10px;
  font-weight: 800;
  text-align: left;
}
.month-picker-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}
.month-picker-option {
  min-height: 36px;
  border-radius: 6px;
  font-weight: 800;
}
.month-picker-nav:hover,
.month-picker-title:hover,
.month-picker-title:focus-visible,
.month-picker-option:hover,
.month-picker-link:hover,
.month-picker-year-option:hover,
.month-picker-year-option:focus-visible,
.month-picker-option:focus-visible {
  background: #edf3ef;
  outline: none;
  text-decoration: none;
}
.month-picker-option.is-selected,
.month-picker-year-option.is-selected {
  background: var(--accent);
  color: #fff;
}
.month-picker-footer {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}
.month-picker-link {
  min-height: 30px;
  border-radius: 6px;
  padding: 0 8px;
  color: var(--accent-dark);
  font-weight: 800;
}
.bill-entry { padding-bottom: 0; }
.bill-meta-panel {
  display: flex;
  align-items: end;
  gap: 14px;
  flex-wrap: wrap;
  margin: 16px 0 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}
.delivery-window-hint {
  margin-left: 10px;
  padding-bottom: 0;
  font-size: 13px;
  color: #b42318;
  font-weight: 700;
  white-space: nowrap;
}
.delivery-date-row {
  display: flex;
  align-items: center;
  gap: 0;
  flex-wrap: wrap;
}
.delivery-date-row .date-picker {
  width: 330px;
  max-width: 100%;
}
.bill-meta-panel label {
  display: grid;
  align-items: flex-end;
  gap: 8px;
  min-width: 220px;
  color: var(--ink);
  font-weight: 900;
}
.bill-meta-panel input {
  min-height: 42px;
  border: 1px solid #cfdcd6;
  border-radius: 6px;
  padding: 8px 10px;
  background: #fff;
  font: inherit;
}
.date-picker {
  position: relative;
  display: block;
}
.date-picker-trigger {
  width: 100%;
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  padding: 8px 10px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  font-weight: 900;
  text-align: left;
}
.date-picker-trigger:hover,
.date-picker-trigger:focus-visible,
.date-picker-trigger[aria-expanded="true"] {
  border-color: var(--accent);
  outline: 3px solid rgba(23, 102, 77, .16);
  outline-offset: 1px;
}
.date-picker-icon {
  color: var(--muted);
  font-size: 13px;
}
.date-picker-panel {
  position: absolute;
  left: 0;
  top: calc(100% + 6px);
  z-index: 25;
  display: grid;
  gap: 8px;
  width: 328px;
  padding: 10px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 42px rgba(16, 24, 32, 0.16);
}
.date-picker-heading,
.date-picker-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.date-picker-nav,
.date-picker-title,
.date-picker-link,
.date-picker-year-option,
.date-picker-day {
  border: 0;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font: inherit;
}
.date-picker-nav {
  width: 34px;
  height: 34px;
  border-radius: 6px;
  font-size: 24px;
  line-height: 1;
}
.date-picker-title {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: 6px;
  padding: 0 10px;
  font-weight: 900;
}
.date-picker-year-list {
  display: grid;
  gap: 3px;
  max-height: 156px;
  overflow-y: auto;
  padding: 2px 0 8px;
  border-bottom: 1px solid var(--line);
}
.date-picker-year-option {
  min-height: 30px;
  border-radius: 6px;
  padding: 0 10px;
  font-weight: 800;
  text-align: left;
}
.date-picker-weekdays,
.date-picker-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 5px;
}
.date-picker-weekdays span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-align: center;
}
.date-picker-day {
  min-height: 34px;
  border-radius: 6px;
  font-weight: 800;
  text-align: center;
}
.date-picker-day.is-empty {
  min-height: 34px;
}
.date-picker-day:disabled {
  cursor: not-allowed;
  color: #a5b0b7;
  background: #f4f6f7;
}
.date-picker-nav:hover,
.date-picker-title:hover,
.date-picker-title:focus-visible,
.date-picker-link:hover,
.date-picker-year-option:hover,
.date-picker-year-option:focus-visible,
.date-picker-day:not(:disabled):hover,
.date-picker-day:focus-visible {
  background: #edf3ef;
  outline: none;
  text-decoration: none;
}
.date-picker-year-option.is-selected,
.date-picker-day.is-selected {
  background: var(--accent);
  color: #fff;
}
.date-picker-footer {
  padding-top: 8px;
  border-top: 1px solid var(--line);
}
.date-picker-link {
  min-height: 30px;
  border-radius: 6px;
  padding: 0 8px;
  color: var(--accent-dark);
  font-weight: 800;
}
.bill-lines-panel {
  min-width: 0;
}
.bill-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 0 14px;
}
.bill-toolbar > div { display: grid; gap: 2px; }
.bill-warning-tip {
  color: #b42318;
  font-weight: 700;
}
.bill-table-wrap { max-height: min(62vh, 680px); }
.bill-table { min-width: 1040px; }
.bill-table input { min-width: 128px; }
.bill-table-actions {
  display: flex;
  justify-content: flex-end;
  padding: 10px 10px 0;
}
.bill-icon-button {
  width: 38px;
  height: 38px;
  min-width: 38px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--accent);
  color: white;
  cursor: pointer;
  font: inherit;
  font-size: 24px;
  font-weight: 900;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: background 180ms var(--ease), border-color 180ms var(--ease), transform 180ms var(--ease);
}
.bill-icon-button:hover { background: var(--accent-dark); }
.bill-icon-button:active { transform: translateY(1px); }
.bill-action-text {
  display: none;
  font-size: 14px;
  line-height: 1;
}
.bill-icon-button-muted {
  background: #edf2ef;
  color: var(--ink);
}
.bill-icon-button-muted:hover {
  background: #e3ebe7;
}
.bill-icon-button-danger {
  border-color: #e7b8b2;
  background: #fff3f1;
  color: var(--bad);
}
.bill-icon-button-danger:hover {
  border-color: #d7867c;
  background: #fde2df;
}
.amount-cell {
  min-width: 112px;
  font-weight: 900;
  color: var(--accent-dark);
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.bill-total {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 16px;
  margin: 14px -18px 0;
  padding: 14px 18px;
  border-top: 1px solid var(--line);
  background: rgba(255,255,255,.94);
  font-weight: 900;
}
.sticky-total {
  position: sticky;
  bottom: 0;
  z-index: 3;
  box-shadow: 0 -10px 24px rgba(16, 24, 32, 0.07);
}
.bill-total strong {
  min-width: 130px;
  text-align: right;
  color: var(--accent-dark);
  font-size: 22px;
  font-variant-numeric: tabular-nums;
}
.modal-backdrop.bill-alert-modal {
  background: transparent;
  pointer-events: none;
  transition: opacity 320ms var(--ease);
}
.modal-backdrop.bill-alert-modal.is-fading {
  opacity: 0;
}
.confirm-dialog.bill-alert-dialog {
  width: min(320px, calc(100vw - 48px));
  padding: 16px 20px;
  border-color: #e7b8b2;
  background: #fffaf9;
  box-shadow: 0 18px 44px rgba(16, 24, 32, 0.18);
  text-align: center;
}
.confirm-dialog.bill-alert-dialog h2 {
  margin: 0;
  color: var(--bad);
  font-size: 18px;
  line-height: 1.35;
}
.modal-backdrop.delete-row-confirm-modal {
  padding: 18px;
}
.confirm-dialog.delete-row-confirm-dialog {
  width: min(340px, calc(100vw - 36px));
  padding: 18px;
  border-radius: 14px;
  border-color: #f0d4cf;
  background: #fffdfc;
  box-shadow: 0 22px 52px rgba(17, 24, 39, 0.20);
}
.confirm-dialog.delete-row-confirm-dialog h2 {
  margin: 0;
  color: var(--ink);
  font-size: 18px;
  line-height: 1.35;
  text-align: center;
}
.delete-row-confirm-dialog .confirm-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 18px;
}
.delete-row-confirm-dialog .confirm-actions .btn {
  width: 100%;
  min-height: 46px;
  justify-content: center;
  border-radius: 10px;
  padding: 0 12px;
}
.delete-row-confirm-dialog .confirm-actions .btn.danger {
  background: #d44f45;
  border-color: #d44f45;
}
.delete-row-confirm-dialog .confirm-actions .btn.danger:hover {
  background: #bd3f36;
  border-color: #bd3f36;
}
.row-action-cell {
  width: 58px;
  text-align: center;
}
.reconciliation-table td:nth-child(n+7):nth-child(-n+12) {
  font-variant-numeric: tabular-nums;
}
.modal-open { overflow: hidden; }
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(17, 24, 39, 0.38);
}
.modal-backdrop[hidden] { display: none; }
.confirm-dialog {
  width: min(440px, 100%);
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 24px 60px rgba(17, 24, 39, 0.18);
}
.confirm-dialog.inbound-line-dialog {
  width: min(1360px, calc(100vw - 40px));
  min-width: min(860px, calc(100vw - 40px));
  max-height: calc(100vh - 72px);
  overflow: auto;
  padding: 18px;
}
.confirm-dialog.inbound-line-dialog-wide {
  max-width: none;
}
.confirm-dialog.inbound-line-dialog .dialog-heading-row {
  margin-bottom: 4px;
}
.confirm-dialog.inbound-line-dialog h2 {
  font-size: 24px;
}
.confirm-dialog.inbound-line-dialog .modal-subtitle {
  margin-bottom: 16px;
}
.confirm-dialog.inbound-line-dialog .modal-table-wrap {
  max-height: calc(100vh - 210px);
  overflow: auto;
}
.confirm-dialog.inbound-line-dialog .data-table {
  width: 100%;
  min-width: 1180px;
  table-layout: fixed;
  border: 1px solid var(--line-strong);
}
.confirm-dialog.inbound-line-dialog .data-table :is(th, td) {
  padding: 6px 10px;
  font-size: 14px;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.confirm-dialog.inbound-line-dialog .data-table :is(th, td):last-child {
  border-right: 0;
}
.confirm-dialog.inbound-line-dialog .data-table tbody tr:last-child td {
  border-bottom: 0;
}
.confirm-dialog.inbound-line-dialog .data-table th:nth-child(1),
.confirm-dialog.inbound-line-dialog .data-table td:nth-child(1),
.confirm-dialog.inbound-line-dialog .data-table th:nth-child(3),
.confirm-dialog.inbound-line-dialog .data-table td:nth-child(3) {
  width: 280px;
}
.confirm-dialog.inbound-line-dialog .data-table th:nth-child(2),
.confirm-dialog.inbound-line-dialog .data-table td:nth-child(2) {
  width: 210px;
}
.confirm-dialog.inbound-line-dialog .data-table th:nth-child(4),
.confirm-dialog.inbound-line-dialog .data-table td:nth-child(4),
.confirm-dialog.inbound-line-dialog .data-table th:nth-child(5),
.confirm-dialog.inbound-line-dialog .data-table td:nth-child(5) {
  width: 68px;
  text-align: center;
}
.confirm-dialog.inbound-line-dialog .data-table th:nth-child(n+6),
.confirm-dialog.inbound-line-dialog .data-table td:nth-child(n+6) {
  width: 78px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.col-resize-dragging {
  cursor: col-resize;
  user-select: none;
}
.resizable-data-table {
  table-layout: fixed;
}
.resizable-data-table th,
.resizable-data-table td {
  overflow: hidden;
  text-overflow: ellipsis;
}
.resizable-data-table th {
  position: relative;
}
.resizable-data-table .col-resizer {
  position: absolute;
  top: 0;
  right: -4px;
  width: 8px;
  height: 100%;
  cursor: col-resize;
  z-index: 3;
  touch-action: none;
}
.resizable-data-table .col-resizer::after {
  content: "";
  position: absolute;
  top: 0;
  right: 3px;
  width: 1px;
  height: 100%;
  background: transparent;
}
.resizable-data-table .col-resizer:hover::after {
  background: #16805f;
}
.resizable-data-table .col-resizer:active::after {
  background: #16805f;
  width: 2px;
}
.confirm-dialog h2 { margin: 0 0 10px; font-size: 20px; }
.confirm-dialog p { margin: 0; color: var(--muted); line-height: 1.7; }
.confirm-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
}
.login-card { width: min(420px, 100%); }
.login-card h1 { font-size: 24px; }

@media (max-width: 480px) {
  .login {
    align-items: center;
    justify-items: stretch;
    padding: 14px;
  }
  .login-card {
    padding: 18px 14px;
  }
  .login-card h1 {
    font-size: 24px;
    line-height: 1.25;
    overflow-wrap: anywhere;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

@media (max-width: 980px) {
  .metric-grid,
  .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .admin-workbench > .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .action-panel {
    align-items: stretch;
    flex-direction: column;
  }
  .workbench-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .container { width: min(100% - 24px, 980px); }
  .admin-bills-filter-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .admin-bills-filter-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }
  .management-forms { grid-template-columns: 1fr; }
  .supplier-card-main {
    grid-template-columns: minmax(0, 1fr) minmax(220px, auto);
    grid-template-areas:
      "identity actions"
      "meta status";
    align-items: start;
  }
  .supplier-identity { grid-area: identity; }
  .supplier-meta { grid-area: meta; }
  .supplier-status { grid-area: status; }
  .supplier-actions { grid-area: actions; }
  .supplier-status,
  .supplier-actions { justify-content: end; }
  .supplier-account-row {
    grid-template-columns: minmax(140px, 0.7fr) minmax(220px, 1fr);
  }
  .supplier-account-row .account-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }
}

@media (max-width: 700px) {
  .topbar {
    padding: 14px 18px;
    align-items: flex-start;
    flex-direction: column;
  }
  .nav { justify-content: flex-start; }
  .page-heading { flex-direction: column; }
  .metric-grid,
  .grid,
  .form-grid {
    grid-template-columns: 1fr;
  }
  .admin-workbench > .metric-grid {
    grid-template-columns: 1fr;
  }
  .data-table th,
  .data-table td,
  th,
  td {
    white-space: normal;
  }
  .bill-toolbar,
  .bill-total {
    align-items: stretch;
    flex-direction: column;
  }
  .bill-total {
    margin-left: -18px;
    margin-right: -18px;
  }
  .bill-total strong { text-align: left; }
  .account-management-toolbar {
    align-items: stretch;
    flex-direction: column;
  }
  .account-management-toolbar .actions,
  .account-summary-strip {
    width: 100%;
  }
  .account-management-toolbar .actions .btn,
  .account-summary-strip > div {
    flex: 1 1 160px;
  }
  .account-tabs {
    width: 100%;
  }
  .account-tabs button {
    flex: 1;
  }
  .search-bar {
    grid-template-columns: 1fr;
  }
  .admin-bills-filter-grid {
    grid-template-columns: 1fr;
  }
  .accounting-settings-form,
  .accounting-settings-form label,
  .accounting-settings-form .btn {
    width: 100%;
    max-width: none;
  }
  .token-settings-panel {
    padding: 18px;
  }
  .token-settings-heading,
  .token-status-card {
    grid-template-columns: 1fr;
  }
  .token-settings-heading {
    align-items: stretch;
  }
  .token-settings-heading .btn,
  .token-settings-actions .btn {
    width: 100%;
  }
  .role-supplier .topbar {
    gap: 12px;
    padding: 12px;
  }
  .role-supplier .brand {
    font-size: 15px;
  }
  .role-supplier .nav {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }
  .role-supplier .nav a,
  .role-supplier .user-chip {
    width: 100%;
    justify-content: center;
  }
  .role-supplier:has(.bill-entry) .topbar {
    align-items: flex-start;
    gap: 0;
    padding: 10px 12px;
  }
  .role-supplier:has(.supplier-history-page) .topbar {
    align-items: flex-start;
    gap: 0;
    padding: 10px 12px;
  }
  .role-supplier:has(.bill-entry) .brand-block,
  .role-supplier:has(.bill-entry) .user-chip,
  .role-supplier:has(.bill-entry) .nav > a:not([href="/supplier"]) {
    display: none;
  }
  .role-supplier:has(.supplier-history-page) .brand-block,
  .role-supplier:has(.supplier-history-page) .user-chip,
  .role-supplier:has(.supplier-history-page) .nav > a:not([href="/supplier"]) {
    display: none;
  }
  .role-supplier:has(.bill-entry) .nav,
  .role-supplier:has(.supplier-history-page) .nav {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    grid-template-columns: none;
  }
  .role-supplier:has(.bill-entry) .nav a[href="/supplier"] {
    width: auto;
    min-height: 38px;
    padding: 0 14px;
  }
  .role-supplier:has(.supplier-history-page) .nav a[href="/supplier"] {
    width: auto;
    min-height: 38px;
    padding: 0 14px;
  }
  .role-supplier:has(.supplier-home-simple) .topbar {
    align-items: center;
    flex-direction: row;
    gap: 10px;
    justify-content: space-between;
    padding: 12px;
  }
  .role-supplier:has(.supplier-home-simple) .brand-block {
    min-width: 0;
  }
  .role-supplier:has(.supplier-home-simple) .brand {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .role-supplier:has(.supplier-home-simple) .user-chip,
  .role-supplier:has(.supplier-home-simple) .nav > a {
    display: none;
  }
  .role-supplier:has(.supplier-home-simple) .nav {
    width: auto;
    display: flex;
    flex: 0 0 auto;
    grid-template-columns: none;
  }
  .role-supplier .supplier-mobile-account {
    position: relative;
    display: block;
  }
  .role-supplier .supplier-mobile-account-trigger {
    min-height: 38px;
    border: 0;
    border-radius: 999px;
    padding: 0 14px;
    background: rgba(255,255,255,.12);
    color: #fff;
    cursor: pointer;
    font: inherit;
    font-weight: 900;
  }
  .role-supplier .supplier-mobile-account-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    z-index: 80;
    display: grid;
    min-width: 132px;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,.16);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 18px 42px rgba(16, 24, 32, .22);
  }
  .role-supplier .supplier-mobile-account-menu[hidden] {
    display: none;
  }
  .role-supplier .supplier-mobile-account-menu a {
    min-height: 42px;
    display: flex;
    align-items: center;
    padding: 0 14px;
    color: var(--ink);
    font-weight: 800;
    text-decoration: none;
    white-space: nowrap;
  }
  .role-supplier .supplier-mobile-account-menu a:hover,
  .role-supplier .supplier-mobile-account-menu a:focus-visible {
    background: #edf3ef;
  }
  .role-supplier .container {
    width: min(100% - 20px, 760px);
    margin-top: 14px;
    margin-bottom: 28px;
  }
  .role-supplier .panel {
    padding: 14px;
  }
  .role-supplier .bill-entry form {
    display: flex;
    flex-direction: column;
  }
  .role-supplier .bill-lines-panel {
    order: 1;
  }
  .role-supplier .bill-meta-panel {
    order: 2;
  }
  .role-supplier .bill-total {
    order: 3;
  }
  .role-supplier .supplier-entry-grid,
  .role-supplier .supplier-history-filter-month {
    grid-template-columns: 1fr;
  }
  .role-supplier .supplier-history-filter {
    gap: 10px;
    margin: 10px 0 14px;
    padding: 12px;
    box-shadow: none;
  }
  .role-supplier .supplier-history-filter label {
    gap: 8px;
  }
  .role-supplier .supplier-history-filter .month-picker-trigger {
    min-height: 48px;
  }
  .role-supplier .month-summary-grid {
    grid-template-columns: 1fr;
    gap: 10px;
    margin: 10px 0 14px;
  }
  .role-supplier .supplier-entry-card {
    min-height: 112px;
  }
  .role-supplier .supplier-history-actions {
    justify-self: stretch;
  }
  .role-supplier .supplier-history-actions .btn {
    flex: 1 1 120px;
  }
  .role-supplier .bill-meta-panel {
    display: grid;
    gap: 10px;
    margin-top: 12px;
  }
  .role-supplier .bill-meta-panel label,
  .role-supplier .delivery-date-row .date-picker {
    width: 100%;
    min-width: 0;
  }
  .role-supplier .date-picker-panel {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    width: 100%;
    max-height: min(72vh, 520px);
    overflow-y: auto;
    padding: 14px;
    border-radius: 16px 16px 0 0;
    z-index: 70;
    box-shadow: 0 -18px 42px rgba(16, 24, 32, 0.18);
  }
  .role-supplier .delivery-window-hint {
    margin-left: 0;
  }
  .role-supplier .bill-table-wrap,
  .role-supplier .supplier-history-table-wrap {
    max-height: none;
    overflow-x: visible;
  }
  .role-supplier .bill-table,
  .role-supplier .supplier-history-table,
  .role-supplier .supplier-line-detail-table {
    min-width: 0;
    border-collapse: separate;
    border-spacing: 0 10px;
    background: transparent;
  }
  .role-supplier .bill-table thead,
  .role-supplier .supplier-history-table thead,
  .role-supplier .supplier-line-detail-table thead {
    display: none;
  }
  .role-supplier .bill-table tbody,
  .role-supplier .supplier-history-table tbody,
  .role-supplier .supplier-line-detail-table tbody,
  .role-supplier .bill-table-card-row,
  .role-supplier .supplier-history-table-card-row,
  .role-supplier .supplier-line-detail-row {
    display: block;
  }
  .role-supplier .bill-table-card-row,
  .role-supplier .supplier-history-table-card-row,
  .role-supplier .supplier-line-detail-row {
    position: relative;
    margin-bottom: 10px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    box-shadow: var(--shadow-sm);
  }
  .role-supplier .bill-table-card-row {
    position: relative;
  }
  .role-supplier .bill-table-card-row td,
  .role-supplier .supplier-history-table-card-row td,
  .role-supplier .supplier-line-detail-row td {
    display: grid;
    grid-template-columns: minmax(0, 112px) minmax(0, 1fr);
    gap: 12px;
    align-items: center;
    min-height: 46px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    white-space: normal;
  }
  .role-supplier .bill-table-card-row td:last-child,
  .role-supplier .supplier-history-table-card-row td:last-child,
  .role-supplier .supplier-line-detail-row td:last-child {
    border-bottom: 0;
  }
  .role-supplier .bill-table-card-row td::before,
  .role-supplier .supplier-history-table-card-row td::before,
  .role-supplier .supplier-line-detail-row td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 13px;
    font-weight: 900;
  }
  .role-supplier .bill-table-card-row input,
  .role-supplier .bill-table-card-row select {
    width: 100%;
    min-width: 0;
  }
  .role-supplier .bill-table-card-row .amount-cell {
    min-width: 0;
    text-align: left;
  }
  .role-supplier .bill-table-card-row .row-action-cell {
    position: absolute;
    top: 10px;
    right: 10px;
    display: block;
    width: auto;
    min-height: 0;
    padding: 0;
    border-bottom: 0;
    text-align: left;
  }
  .role-supplier .bill-table-card-row .row-action-cell::before {
    content: none;
  }
  .role-supplier .bill-table-card-row .row-action-cell .bill-icon-button {
    justify-self: start;
    width: auto;
    min-width: 58px;
    height: 34px;
    padding: 0 10px;
    font-size: 14px;
  }
  .role-supplier .bill-icon-button .bill-action-text {
    display: inline;
  }
  .role-supplier .bill-icon-button .bill-action-symbol {
    display: none;
  }
  .role-supplier .bill-table-actions {
    justify-content: stretch;
    padding: 8px 0 0;
  }
  .role-supplier .bill-table-actions .bill-icon-button {
    width: 100%;
    height: 44px;
    font-size: 16px;
  }
  .role-supplier .bill-total {
    gap: 8px;
    padding-bottom: calc(14px + env(safe-area-inset-bottom));
  }
  .role-supplier .bill-total .btn {
    width: 100%;
  }
  .role-supplier .history-row-actions .btn {
    width: 100%;
  }
  .role-supplier .bill-detail-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  .supplier-card-main,
  .supplier-title,
  .supplier-account-row,
  .supplier-create-form,
  .account-create-form,
  .account-create-dialog .supplier-create-form {
    grid-template-columns: 1fr;
  }
  .supplier-card-main {
    grid-template-areas:
      "identity"
      "meta"
      "status"
      "actions";
  }
  .supplier-status,
  .supplier-actions,
  .account-actions,
  .inline-password-form {
    justify-content: flex-start;
  }
}
