:root {
  color-scheme: light;
  --ink: #232a29;
  --muted: #576662;
  --line: #dce5e2;
  --accent: #215e52;
  --due: #9b4c25;
  font: 100%/1.5 "Microsoft YaHei UI", "PingFang SC", system-ui, sans-serif;
  background: #f2f6f4;
  color: var(--ink);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
button, input, select, textarea { font: inherit; }
button, input, select, textarea {
  background: white;
  border: 1px solid #bfcfc9;
  border-radius: 8px;
  color: inherit;
  padding: .55rem .8rem;
}
button { cursor: pointer; font-weight: 600; }
button:disabled { opacity: .5; cursor: default; }
button:hover:not(:disabled) { background: #edf4f1; }
:focus-visible { outline: 3px solid #398676; outline-offset: 2px; }
.wrap { width: min(1240px, calc(100% - 3rem)); margin: auto; }
.bar { background: #183c35; color: white; }
.brand { display: flex; align-items: center; min-height: 66px; gap: .85rem; }
.mark { display: grid; place-items: center; width: 35px; height: 35px; border-radius: 9px; background: #d5ebe1; color: #173e35; font: bold 1.55rem Georgia, serif; }
.demo { margin-left: auto; color: #d5ebe1; font-size: .875rem; }
.brand nav { display: flex; gap: .85rem; }
.brand a { color: #d5ebe1; font-size: .875rem; white-space: nowrap; text-underline-offset: .2em; }
.brand strong, .demo { white-space: nowrap; }
.login-panel { max-width: 27rem; margin-top: 2rem; padding: 1.25rem; background: white; border: 1px solid var(--line); border-radius: 14px; }
#cloudActions { flex-wrap: wrap; }
.photo-field button { margin-top: .45rem; }
.heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin: 2.6rem 0 1.5rem; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(1.65rem, 4vw, 2.3rem); letter-spacing: .03em; }
.heading p { color: var(--muted); margin-top: .3rem; }
.primary { background: var(--accent); color: white; border-color: var(--accent); white-space: nowrap; }
.primary:hover:not(:disabled) { background: #19493f; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-bottom: 1.5rem; }
.stats > div, .panel { background: white; border: 1px solid var(--line); border-radius: 14px; }
.stats > div { padding: .9rem 1.25rem; }
.stats span { color: var(--muted); display: block; font-size: .875rem; }
.stats strong { font-size: clamp(1.25rem, 4vw, 2rem); font-variant-numeric: tabular-nums; }
.due { color: var(--due); }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; padding: 1rem; }
.filters { display: flex; flex-wrap: wrap; gap: .25rem; }
.filters button { border-color: transparent; font-size: .875rem; }
.filters [aria-pressed="true"] { color: var(--accent); background: #e0f0e9; }
input[type="search"] { width: min(100%, 265px); font-size: .875rem; }
.table-scroll { overflow-x: auto; }
.pagination { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: .65rem; padding: .75rem 1rem; border-top: 1px solid var(--line); font-size: .875rem; }
.list-message { padding: 0 1rem .75rem; color: var(--muted); font-size: .875rem; }
.list-message:empty { display: none; }
.row-actions { display: flex; gap: .4rem; }
.delete-record { color: #a12f26; white-space: nowrap; padding: .35rem .55rem; }
table { border-collapse: collapse; width: 100%; min-width: 1070px; font-size: .9rem; }
th, td { padding: .85rem 1rem; text-align: left; border-top: 1px solid var(--line); }
th { color: var(--muted); background: #f6f9f8; font-weight: 600; }
td { height: 74px; }
tr:hover td { background: #f8fbfa; }
.order-link { border: 0; color: var(--accent); padding: .25rem; font-variant-numeric: tabular-nums; }
.edit-order { white-space: nowrap; padding: .35rem .55rem; color: var(--accent); }
.item { display: flex; align-items: center; gap: .65rem; min-width: 148px; overflow-wrap: anywhere; }
.thumbnail { flex: 0 0 38px; width: 38px; height: 38px; display: grid; place-items: center; border-radius: 8px; object-fit: cover; color: var(--accent); background: #e7f1ed; }
time, .amounts, .status { white-space: nowrap; }
.amounts > * { display: block; }
.paid, .note { color: var(--muted); }
.status { padding: .2rem .55rem; border-radius: 50px; background: #f8eddd; color: #754c20; }
.status.done { background: #e1f1e9; color: #215e52; }
.note { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; white-space: pre-line; }
.empty { text-align: center; color: var(--muted); }
.foot { color: var(--muted); font-size: .875rem; margin: 1rem 0 2rem; }
.ledger-filter { display: flex; flex-wrap: wrap; gap: .65rem 1rem; margin-bottom: 1rem; }
.ledger-filter label { display: flex; align-items: center; gap: .5rem; font-size: .875rem; color: var(--muted); }
.ledger-filter input[type="number"] { width: 7rem; }
.ledger-table { min-width: 530px; }
dialog { width: min(560px, calc(100% - 2rem)); max-height: 92dvh; border: 1px solid var(--line); border-radius: 16px; padding: 1.3rem; color: var(--ink); }
dialog::backdrop { background: #122c26a8; }
.dialog-head, .actions { display: flex; align-items: center; justify-content: space-between; gap: .6rem; }
.dialog-head button { border-color: transparent; font-size: 1.3rem; }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem; margin-top: .8rem; }
.fields label { display: grid; align-content: start; gap: .25rem; font-size: .875rem; font-weight: 600; }
.fields input, .fields select, .fields textarea { min-width: 0; width: 100%; font-size: 1rem; font-weight: 400; }
.wide { grid-column: 1 / -1; }
#preview { max-width: 100%; max-height: 110px; border-radius: 8px; }
#removeImage { justify-self: start; }
#payments { border-top: 1px solid var(--line); padding-top: .8rem; margin-top: .8rem; }
.payment-row { border: 1px solid var(--line); border-radius: 8px; margin: .6rem 0; min-width: 0; }
.payment-row .fields { margin-top: 0; }
.payment-row button { margin-top: .65rem; font-size: .875rem; }
.actions { justify-content: flex-end; margin-top: 1rem; }
.error { color: #a12f26; margin-top: .6rem; }
.error:empty { display: none; }
@media (max-width: 620px) {
  .wrap { width: calc(100% - 1.5rem); }
  .brand { gap: .5rem; }
  .brand nav { gap: .55rem; }
  .heading { margin-top: 1.35rem; }
  .heading p { font-size: .875rem; }
  .stats { gap: .4rem; }
  .stats > div { padding: .65rem .4rem; }
  .toolbar { padding: .65rem; }
}
