:root {
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei",
    "PingFang SC", sans-serif;
  color: #20243a;
  background: #f7f8fc;
  --ink: #20243a;
  --muted: #626b80;
  --line: #e5e8f1;
  --accent: #4b42c2;
  --accent-strong: #372eaa;
  --accent-wash: #eeedfc;
  --surface: #fff;
  --success: #176747;
  --danger: #9a2e3e;
  --radius: 12px;
  font-size: 14px;
  line-height: 1.5;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}
body {
  margin: 0;
}
[hidden] {
  display: none !important;
}
button,
input,
select,
textarea {
  font: inherit;
}
button {
  cursor: pointer;
}
button:disabled {
  cursor: default;
  opacity: 0.58;
}
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
h1,
h2,
h3,
p {
  margin: 0;
}
label {
  min-width: 0;
}
input,
select,
textarea {
  width: 100%;
  min-width: 0;
  min-height: 42px;
  border: 1px solid #d6daea;
  border-radius: 8px;
  background: white;
  color: var(--ink);
  padding: 8px 11px;
}
input::placeholder,
textarea::placeholder {
  color: #737b90;
}
textarea {
  min-height: 85px;
  resize: vertical;
}
input[type="checkbox"] {
  width: 18px;
  height: 18px;
  min-height: 0;
  accent-color: var(--accent);
}
.button {
  display: inline-flex;
  min-height: 39px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 7px 13px;
  border: 1px solid #dce0ed;
  border-radius: 8px;
  background: white;
  color: var(--ink);
  font-weight: 600;
  white-space: nowrap;
}
.button:not(:disabled):hover {
  background: #f1f2f8;
}
.button.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: white;
}
.button.primary:not(:disabled):hover {
  background: var(--accent-strong);
}
.button.quiet {
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}
.button.compact {
  min-height: 33px;
  padding: 4px 8px;
  font-size: 13px;
}
.button.danger {
  color: var(--danger);
}
.icon {
  width: 18px;
  height: 18px;
  flex: none;
  vertical-align: middle;
}
.muted {
  color: var(--muted);
}
.eyebrow {
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.075em;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
}
.brand-mark {
  display: grid;
  flex: none;
  width: 37px;
  height: 37px;
  place-items: center;
  border-radius: 11px;
  background: var(--accent);
  color: white;
  font-size: 19px;
  font-weight: 700;
}
.brand strong,
.brand small {
  display: block;
}
.brand strong {
  font-size: 15px;
  letter-spacing: -0.02em;
}
.brand small {
  margin-top: 1px;
  color: var(--muted);
  font-size: 11px;
}
.sign-in {
  display: grid;
  min-height: 100vh;
  min-height: 100dvh;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr);
}
.sign-in-context {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 36px;
  padding: clamp(29px, 6vw, 95px);
  background: #2b2471;
  color: white;
}
.sign-in-context .brand-mark {
  background: #6258d4;
}
.sign-in-context .brand small,
.sign-in-foot {
  color: #d4d0ed;
}
.sign-in-intro h1 {
  font-size: clamp(29px, 4.5vw, 56px);
  line-height: 1.15;
  letter-spacing: -0.055em;
}
.sign-in-intro p {
  max-width: 31ch;
  margin-top: 18px;
  color: #dfdcf2;
  font-size: 16px;
  line-height: 1.75;
}
.sign-in-foot {
  font-size: 12px;
}
.sign-in-main {
  display: grid;
  place-items: center;
  padding: 26px;
}
.login-form {
  display: grid;
  width: min(100%, 390px);
  gap: 15px;
  padding: clamp(23px, 4vw, 39px);
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: 0 18px 65px #2e256619;
}
.login-form h2 {
  margin-top: -8px;
  font-size: 28px;
  line-height: 1.3;
  letter-spacing: -0.04em;
}
.login-form > .muted {
  margin-top: -9px;
}
.login-form label,
.field {
  display: grid;
  gap: 6px;
  font-weight: 600;
}
.login-form input {
  font-weight: 400;
}
.login-form .button {
  min-height: 44px;
}
.connection {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}
.connection::before {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #8690a6;
  content: "";
}
.connection[data-health="ready"]::before {
  background: #219667;
}
.connection[data-health="offline"]::before {
  background: #ba4655;
}

.workspace {
  display: grid;
  min-height: 100vh;
  min-height: 100dvh;
  grid-template-columns: 224px minmax(0, 1fr);
}
.skip {
  position: fixed;
  z-index: 5;
  top: -100px;
  left: 12px;
  padding: 9px 13px;
  border-radius: 6px;
  background: white;
  color: var(--accent);
}
.skip:focus {
  top: 12px;
}
.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  height: 100vh;
  height: 100dvh;
  flex-direction: column;
  gap: 7px;
  overflow: auto;
  padding: 24px 16px 17px;
  border-right: 1px solid var(--line);
  background: white;
}
.sidebar .brand {
  margin: 0 5px 24px;
}
.nav-label {
  margin: 0 10px 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}
.sidebar nav {
  display: grid;
  gap: 5px;
}
.nav-button {
  display: flex;
  min-height: 42px;
  align-items: center;
  gap: 10px;
  padding: 7px 11px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #4a5268;
  font-weight: 600;
  text-align: left;
  white-space: nowrap;
}
.nav-button:hover {
  background: #f5f5fa;
}
.nav-button[aria-current="page"] {
  background: var(--accent-wash);
  color: var(--accent-strong);
}
.sidebar-foot {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: auto;
  padding: 14px 7px 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}
.sidebar-foot span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #9086e6;
}
.main {
  min-width: 0;
}
.topbar {
  display: flex;
  min-height: 67px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px clamp(16px, 3vw, 38px);
  border-bottom: 1px solid var(--line);
  background: white;
}
.breadcrumb {
  min-width: 0;
  color: var(--muted);
  font-size: 13px;
}
.top-actions {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 14px;
}
.admin-name {
  max-width: 170px;
  overflow: hidden;
  color: #454d65;
  font-size: 13px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.page {
  width: min(100%, 1570px);
  min-width: 0;
  margin: 0 auto;
  padding: 29px clamp(16px, 3vw, 38px) 45px;
}
.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}
.page-heading h1 {
  font-size: clamp(25px, 2.7vw, 33px);
  line-height: 1.2;
  letter-spacing: -0.045em;
}
.page-heading p {
  margin-top: 7px;
  color: var(--muted);
}
.page-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 13px;
  margin-bottom: 19px;
}
.metric,
.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
  box-shadow: 0 3px 10px #20243a05;
}
.metric {
  min-width: 0;
  padding: 16px 15px;
}
.metric-title {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}
.metric-title .icon {
  color: var(--accent);
}
.metric strong {
  display: block;
  margin: 8px 0 2px;
  overflow-wrap: anywhere;
  font-size: clamp(19px, 2.45vw, 29px);
  line-height: 1.23;
  letter-spacing: -0.035em;
  font-variant-numeric: tabular-nums;
}
.metric p {
  color: var(--muted);
  font-size: 12px;
}
.panel {
  min-width: 0;
}
.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 17px;
  border-bottom: 1px solid var(--line);
}
.panel-header h2 {
  font-size: 17px;
}
.panel-header p {
  color: var(--muted);
  font-size: 12px;
}
.table-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px;
  padding: 14px 16px;
}
.table-tools label {
  display: grid;
  min-width: 115px;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
}
.table-tools label:first-child {
  flex: 1 1 195px;
  max-width: 360px;
}
.table-tools input,
.table-tools select {
  min-height: 38px;
  font-size: 13px;
}
.table-status {
  margin-left: auto;
  padding-bottom: 9px;
  color: var(--muted);
  font-size: 12px;
}
.table-scroll {
  max-width: 100%;
  overflow-x: auto;
}
table {
  width: 100%;
  border-spacing: 0;
  border-collapse: collapse;
  font-size: 13px;
}
th {
  background: #f3f4f9;
  color: #525c74;
  font-weight: 650;
  text-align: left;
  white-space: nowrap;
}
th,
td {
  padding: 11px 13px;
  border-bottom: 1px solid #edf0f5;
  vertical-align: middle;
}
tbody tr:last-child td {
  border-bottom: 0;
}
tbody tr:hover {
  background: #fafaff;
}
td {
  overflow-wrap: anywhere;
}
.cell-money,
.cell-date,
.cell-actions {
  white-space: nowrap;
}
.cell-money {
  font-variant-numeric: tabular-nums;
}
.cell-note {
  min-width: 120px;
  max-width: 250px;
  white-space: pre-wrap;
}
.cell-secondary {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}
.cell-actions {
  text-align: right;
}
.cell-actions .button + .button {
  margin-left: 5px;
}
.record-in {
  color: var(--success);
}
.record-out {
  color: var(--danger);
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 20px;
  background: #f0f1f5;
  color: #555e70;
  font-size: 12px;
  white-space: nowrap;
}
.badge.enabled {
  background: #eaf6ef;
  color: var(--success);
}
.badge.kind {
  background: var(--accent-wash);
  color: var(--accent-strong);
}
.empty,
.loading {
  display: grid;
  justify-items: center;
  gap: 7px;
  min-height: 180px;
  align-content: center;
  padding: 24px 18px;
  color: var(--muted);
  text-align: center;
}
.empty strong {
  color: var(--ink);
  font-size: 15px;
}
.empty .icon {
  width: 29px;
  height: 29px;
  color: #8a82cb;
}
.load-error {
  margin-bottom: 14px;
}

#editor {
  width: min(560px, calc(100% - 24px));
  max-height: calc(100vh - 26px);
  max-height: calc(100dvh - 26px);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: white;
  color: var(--ink);
  box-shadow: 0 20px 80px #1e193d35;
}
#editor[open] {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
#editor::backdrop {
  background: #1c1b3b7a;
}
.editor-header {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 15px 19px;
  border-bottom: 1px solid var(--line);
}
.editor-header h2 {
  font-size: 19px;
  letter-spacing: -0.035em;
}
.editor-header .button {
  min-height: 32px;
  font-size: 16px;
}
.editor-form {
  display: flex;
  min-height: 0;
  flex-direction: column;
}
.editor-body {
  display: grid;
  gap: 13px;
  overflow: auto;
  padding: 17px 19px;
}
.editor-actions {
  display: flex;
  flex: none;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 19px;
  border-top: 1px solid var(--line);
  background: #fafaff;
}
.field {
  color: #31394f;
  font-size: 13px;
}
.field input,
.field select,
.field textarea {
  font-weight: 400;
}
.field small,
.form-help {
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
}
.fields-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.check {
  display: flex;
  align-items: center;
  gap: 7px;
  color: #39415a;
}
.error-note {
  padding: 9px 11px;
  border: 1px solid #edd1d8;
  border-radius: 7px;
  background: #fff2f4;
  color: var(--danger);
  font-size: 13px;
}
.review-fields {
  margin: 0;
}
.review-fields div {
  display: grid;
  grid-template-columns: minmax(65px, 1fr) minmax(0, 2fr);
  gap: 9px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}
.review-fields dt {
  color: var(--muted);
}
.review-fields dd {
  margin: 0;
  overflow-wrap: anywhere;
  text-align: right;
  white-space: pre-wrap;
}
.review-highlight {
  padding: 12px;
  border-radius: 8px;
  background: var(--accent-wash);
  color: var(--accent-strong);
}
.related-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.receipt-voucher {
  display: grid;
  justify-items: start;
  gap: 8px;
  margin: 0;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fafaff;
}
.receipt-voucher figcaption {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}
.receipt-voucher img {
  max-width: 100%;
  max-height: 40vh;
  object-fit: contain;
}
.field input:disabled,
.field select:disabled,
.field input[readonly] {
  background: #f3f4f9;
  color: var(--muted);
}
.notice {
  position: fixed;
  z-index: 7;
  right: 15px;
  bottom: 15px;
  width: min(380px, calc(100% - 30px));
  padding: 12px 15px;
  border-radius: 9px;
  background: #28264a;
  color: white;
  box-shadow: 0 7px 27px #27254842;
}

@media (max-width: 1000px) {
  .workspace {
    grid-template-columns: 178px minmax(0, 1fr);
  }
  .sidebar {
    padding-inline: 12px;
  }
  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 720px) {
  .workspace {
    display: block;
  }
  .sidebar {
    position: static;
    height: auto;
    gap: 5px;
    padding: 13px 12px 8px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .sidebar .brand {
    margin: 0 3px 4px;
  }
  .sidebar nav {
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 3px;
    padding: 4px 2px;
  }
  .nav-button {
    min-height: 46px;
    flex-direction: column;
    justify-content: center;
    gap: 2px;
    padding: 4px 1px;
    font-size: clamp(11px, 3.5vw, 13px);
    text-align: center;
  }
  .nav-button .icon {
    width: 15px;
    height: 15px;
  }
  .nav-label,
  .sidebar-foot {
    display: none;
  }
  .topbar {
    min-height: 51px;
    padding-block: 5px;
  }
  .top-actions {
    gap: 7px;
  }
  .admin-name {
    max-width: 88px;
  }
  .topbar .connection {
    display: none;
  }
  .page {
    padding-top: 20px;
  }
  .page-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 17px;
  }
  .table-tools label:first-child {
    max-width: none;
  }
  .sign-in {
    display: block;
  }
  .sign-in-context {
    gap: 15px;
    padding: 21px;
  }
  .sign-in-intro h1 {
    font-size: 26px;
  }
  .sign-in-intro p {
    max-width: none;
    margin-top: 5px;
    font-size: 14px;
  }
  .sign-in-foot {
    display: none;
  }
  .sign-in-main {
    padding: 21px 16px;
  }
}
@media (max-width: 520px) {
  .sidebar nav {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
@media (max-width: 390px) {
  .metrics {
    gap: 8px;
  }
  .metric {
    padding: 13px 9px;
  }
  .page {
    padding-inline: 11px;
  }
  .fields-pair {
    grid-template-columns: 1fr;
  }
  .editor-header,
  .editor-body,
  .editor-actions {
    padding-inline: 13px;
  }
}
