:root{color-scheme:light;--ink:#162c29;--muted:#526861;--blue:#09685b;--line:#cdd9d3;--paper:#f5f7f3;--mint:#def3e9;font-family:"Inter","Microsoft YaHei","PingFang SC",system-ui,sans-serif;color:var(--ink);background:var(--paper)}
*{box-sizing:border-box}body{margin:0}button,input,select,textarea{font:inherit;color:inherit}button{cursor:pointer}button:disabled{cursor:default}
.top{background:#12483f;color:white;border-bottom:3px solid #9fcca8}.top>div{max-width:1740px;margin:auto;padding:12px clamp(14px,2.6vw,46px)}
.brand,.account{display:flex;align-items:center;gap:.65rem}.brand{letter-spacing:.05em;font-size:1.08rem}.brand img{width:28px;height:28px}.account{font-size:.86rem;color:#d4e9df}.account button{color:white;background:transparent;border-color:#7a9c92;padding:4px 12px}.account button:hover:enabled{color:var(--ink)}
main,.help{max-width:1740px;margin:0 auto}main{padding:24px clamp(14px,2.6vw,46px) 0}.heading{margin-bottom:18px}.heading>div:first-child{display:block}.heading h1{font-size:clamp(23px,2.1vw,33px);letter-spacing:-.03em}.heading p{margin:5px 0 0;font-size:.9rem}.heading .actions{gap:6px}button,input,select,textarea{border-radius:5px}button.primary,.login-card button{background:var(--blue);border-color:var(--blue);color:white}button.primary:hover:enabled,.login-card button:hover{background:#084f46}.heading .actions button{min-height:37px}


.book{border-radius:10px;box-shadow:0 4px 16px #0c382808}.toolbar{padding:10px 14px;gap:8px}.filters{gap:8px 15px}.filters label{font-size:.88rem}.filters input{width:clamp(135px,13vw,210px)}.status{padding:5px 13px;background:#fafcf9}.grid{max-height:max(255px,calc(100dvh - 245px));min-height:125px}.grid td{font-family:inherit}.grid td .cell{padding-inline:9px}.grid td[data-key="F"],.grid td[data-key="G"],.grid td[data-key="H"],.grid td[data-key="D"],.grid td[data-key="E"]{text-align:right;font-variant-numeric:tabular-nums}.grid td[data-key="I"]{font-weight:600;color:#31584b}.grid .sheet-head td{background:#e4f0e7!important;color:#21443a;text-align:left;font-weight:650}.grid thead th,.grid tbody th,.tab-strip{background:#eef3ee}.detail-link{color:#0c6656;font-weight:600;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.tabs button[aria-current],.tabs .active{color:#075e50;border-top-color:#20816c}.help{padding:12px clamp(14px,2.6vw,46px) 22px;color:var(--muted);font-size:.87rem}.help summary{cursor:pointer;width:fit-content}
.viewer #add,.viewer #new-month,.viewer #undo,.viewer .format-tools,.viewer .size-handle{display:none}.viewer [data-move-key]{cursor:default}
dialog{color:var(--ink);border:1px solid var(--line);border-radius:12px;padding:20px}#details{width:min(760px,calc(100vw - 20px));max-height:90dvh}.dialog-title{display:flex;align-items:center;justify-content:space-between;position:sticky;top:-20px;background:white;padding:10px 0;z-index:2;border-bottom:1px solid var(--line)}.dialog-title p{margin:4px 0;color:var(--muted);font-size:.85rem}.detail-section{margin:17px 0}h3{margin:0 0 9px;font-size:1rem;color:#195d4c}.detail-fields{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px}.detail-fields label,#detail-body form>label{display:grid;gap:4px;color:var(--muted);font-size:.88rem}.detail-fields small{font-size:.7rem}#detail-body input,#detail-body select,#detail-body textarea,#month-input{border:1px solid var(--line);border-radius:5px;min-width:0;max-width:100%;padding:7px 8px;background:white}#detail-body :disabled{color:#42534c;background:#f3f6f3;opacity:1}#detail-body form>.primary{margin-top:12px}.payment-line,.upload-line,.file-line{display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin-bottom:6px}.payment-line input{width:145px}.check{display:inline-flex;gap:5px;align-items:center;margin:5px 10px;font-size:.87rem}.files-list{padding:9px 0;color:var(--muted);font-size:.9rem}.file-line a{color:var(--blue);overflow-wrap:anywhere}.file-line small{color:var(--muted)}.upload-line input{width:220px}.detail-section>small{color:var(--muted)}#detail-msg{position:sticky;bottom:0;background:white;color:#824919;margin:0;padding:4px;font-size:.9rem}#detail-msg:empty{display:none}
.login-page{min-height:100dvh;display:grid;place-items:center;background:linear-gradient(140deg,#e6efe9,#f6f8f3 50%,#e8f0e9);padding:18px}.login-card{padding:32px;width:min(385px,100%);margin:0;border:1px solid var(--line);border-radius:14px;background:white;box-shadow:0 12px 45px #18392b0d}.brandmark{display:grid;place-items:center;width:42px;height:42px;background:#12574a;color:white;border-radius:9px;font-size:30px}.login-card h1{font-size:26px;margin:15px 0 5px}.login-card p{margin:0 0 22px;color:var(--muted)}.login-card form{display:grid;gap:8px}.login-card label{font-size:.9rem}.login-card input,.login-card button{height:43px;padding:8px 12px;border:1px solid var(--line);border-radius:5px}.login-card button{margin-top:5px;border:0}.login-card #message{margin:0;color:#a43729}
@media(max-width:700px){main{padding:14px 9px 0}.heading{gap:10px;margin-bottom:12px}.heading p{font-size:.8rem}.heading .actions button{padding:5px 9px;min-height:32px}.filters{display:grid;width:100%;grid-template-columns:1fr 1fr;gap:6px}.filters label{font-size:.8rem}.toolbar{padding:8px}.cards{max-height:none}.cards article{border:1px solid var(--line);margin:8px;border-radius:6px;padding:10px}.mobile-amounts{display:grid;grid-template-columns:repeat(3,1fr);gap:4px;margin:10px 0}.mobile-amounts small,.mobile-amounts b{display:block}.mobile-amounts small,.cards .card-head>span{font-size:.77rem;color:var(--muted)}.mobile-amounts b{font-variant-numeric:tabular-nums;font-size:.92rem}.pill{background:var(--mint);padding:3px 8px;border-radius:20px}.card-head button{font-size:.8rem;padding:4px 7px}.detail-fields{grid-template-columns:repeat(2,minmax(0,1fr))}dialog{padding:12px}.dialog-title{top:-12px}.payment-line{display:grid;grid-template-columns:1.2fr 1fr auto}.payment-line input{width:100%}.help{padding:10px}.login-card{padding:25px}}

@media (min-width:701px) {
  .ledger-page {
    height:100vh;
    height:100dvh;
    display:flex;
    flex-direction:column;
    overflow:hidden;
  }
  .ledger-header {
    display:grid;
    grid-template-columns:auto minmax(0,1fr) auto auto;
    grid-template-areas:"brand title actions account";
    align-items:center;
    gap:clamp(8px,1.3vw,24px);
    padding:5px clamp(10px,1.2vw,24px);
    color:white;
    background:#12483f;
    border-bottom:2px solid #9fcca8;
  }
  .ledger-header .top, .ledger-header .top>div, .ledger-header .heading {display:contents}
  .ledger-header .brand {grid-area:brand;white-space:nowrap;font-size:1rem}
  .ledger-header .brand img {width:23px;height:23px}
  .ledger-header .heading>div:first-child {grid-area:title;display:block;min-width:0;border-left:1px solid #719c90;padding-left:clamp(8px,1.3vw,24px)}
  .ledger-header h1 {font-size:clamp(1rem,1.2vw,1.25rem);line-height:1.2}
  .ledger-header .heading p {display:none}
  .ledger-header .heading .actions {grid-area:actions;gap:5px}
  .ledger-header .heading .actions button {min-height:29px;padding:4px 10px;font-size:.875rem;line-height:1.25;color:var(--ink)}
  .ledger-header .heading .actions button.primary {background:#cef0da;border-color:#cef0da;color:#104a3c}
  .ledger-header .heading .actions button.primary:hover:enabled {background:#e2f8ea}
  .ledger-header .account {grid-area:account;white-space:nowrap}
  .ledger-page main {flex:1;display:flex;width:100%;max-width:none;min-height:0;padding:5px 8px}
  .ledger-page .book {
    flex:1;
    display:grid;
    min-width:0;
    min-height:0;
    grid-template-columns:minmax(0,1fr) auto auto;
    grid-template-rows:auto minmax(0,1fr) auto;
    grid-template-areas:"tools tools tools" "sheet sheet sheet" "tabs status help";
    border-radius:6px;
    background:#eef3ee;
  }
  .book>.toolbar {grid-area:tools;gap:5px 10px;padding:5px 9px;background:white}
  .book .filters {gap:5px 12px}
  .book .filters select,.book .filters input {height:30px}
  .book>.grid {grid-area:sheet;min-width:0;min-height:0;max-height:none;overflow:auto;overscroll-behavior:contain;background:white}
  .book>.grid {scroll-padding-inline-start:var(--company-edge,40px);scroll-padding-block-start:68px}
  .grid [data-frozen-company="A"] {left:var(--company-A-left,40px)}
  .grid [data-frozen-company="B"] {left:var(--company-B-left,140px);border-right-color:#97b1a4}
  .grid td[data-frozen-company] {position:sticky;z-index:2}
  .grid tr.sheet-head>td {z-index:3}
  .grid tr.sheet-head>th {z-index:5}
  .grid thead th {z-index:4}
  .grid tr.sheet-head>td[data-frozen-company] {z-index:5}
  .grid thead th[data-frozen-company],.grid thead th:first-child {z-index:6}
  .grid [data-frozen-company] .column-control {cursor:default}
  .book>.tab-strip {grid-area:tabs;min-width:0}
  .book .tabs {padding:2px 4px 0}
  .book .tabs button {padding:5px 11px;font-size:.9rem;white-space:nowrap}
  .book>.status,.book>.help {display:flex;align-items:center;margin:0;border:0;border-top:1px solid var(--line);background:transparent}
  .book>.status {grid-area:status;max-width:min(42vw,620px);padding:3px 10px;line-height:1.35;overflow-wrap:anywhere}
  .book>.help {grid-area:help;position:relative;padding:0 10px;font-size:.83rem}
  .book>.help summary {white-space:nowrap}
  .book>.help p {position:absolute;z-index:9;bottom:100%;right:3px;width:min(360px,75vw);max-height:60vh;overflow:auto;margin:0;padding:12px 14px;background:white;color:var(--ink);border:1px solid var(--line);border-radius:7px;box-shadow:0 6px 20px #163a2d26;line-height:1.6}
}
.grid td[data-calculated] .cell-value {text-decoration:underline dotted;text-underline-offset:3px}
.grid td.invoice-unissued {background-color:#ffe8a6!important;color:#75400b!important;font-weight:650}
.trade-note {margin:7px 0 0;color:var(--muted);font-size:.85rem}
.trade-note.error {color:#a63023}
#detail-body .calculated {background:#f3f8f3}
#detail-body .calculated::placeholder {color:#235848;opacity:1}
.mobile-card-toolbar {display:none}
@media (max-width:700px) {
  .ledger-header>.heading {padding:14px 9px 0;margin-bottom:0}
  .ledger-page .help {width:100%}
  .book.has-cards #count {display:none}
  .book.has-cards .mobile-card-toolbar {display:flex;align-items:center;justify-content:space-between;gap:4px 8px;flex-wrap:wrap;padding:7px 9px 2px}
  .mobile-card-modes {display:inline-flex;flex-wrap:wrap;gap:2px;background:#eef3ee;border:1px solid var(--line);border-radius:7px;padding:2px}
  .mobile-card-modes button {padding:5px clamp(5px,1.9vw,10px);min-height:32px;font-size:.875rem;border:1px solid transparent;background:transparent;white-space:nowrap}
  .mobile-card-modes button[aria-pressed="true"] {background:white;color:var(--blue);border-color:#a9ccbd;font-weight:700}
  #mobile-card-count {color:var(--muted);font-size:.85rem}
  .mobile-progress,.mobile-document-heading {display:flex;align-items:center;gap:4px 6px;flex-wrap:wrap}
  .mobile-document-heading {justify-content:space-between;color:var(--muted)}
  .mobile-document-status {display:flex;align-items:center;justify-content:space-between;gap:4px 8px;margin-top:4px}
  .mobile-document-status small {margin:0}
  .mobile-status {border-radius:4px;line-height:1.4;font-size:.79rem}
  .mobile-status.needs-action {padding:1px 5px;background:#fff0ce;color:#84400d;font-weight:700;box-shadow:inset 0 0 0 1px #edc587}
  #detail-body label.needs-action {color:#84400d;font-weight:700}
  #detail-body label.needs-action select {color:#84400d;background:#fff0ce;border-color:#edc587}
}
@media (max-width:360px) {
  .mobile-card-modes button {padding:5px 4px;font-size:.8rem}
}
