:root {
  color-scheme: light;
  --ink: #203834;
  --muted: #536860;
  --pine: #133f39;
  --green: #17644e;
  --sage: #eaf1e9;
  --line: #d3ddd3;
  --paper: #f6f7f1;
  --white: #fff;
  --amber: #925611;
  --red: #934529;
  font:
    16px/1.52 'Avenir Next',
    'Thonburi',
    'Noto Sans Thai',
    system-ui,
    sans-serif;
  background: var(--paper);
  color: var(--ink);
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}
button,
a {
  touch-action: manipulation;
}
button,
.btn {
  min-height: 45px;
  padding: 0.58rem 1rem;
  border: 1px solid var(--line);
  border-radius: 0.65rem;
  background: white;
  color: var(--ink);
  cursor: pointer;
  font-weight: 650;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}
button:hover,
.btn:hover {
  border-color: #6c9680;
  background: #f0f6ee;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid #b97d36;
  outline-offset: 3px;
}
button.primary,
.btn.primary {
  background: var(--green);
  border-color: var(--green);
  color: white;
}
button.primary:hover,
.btn.primary:hover {
  background: #104e3e;
}
button[disabled] {
  opacity: 0.55;
  cursor: wait;
}
a {
  color: var(--green);
}
h1,
h2,
h3,
p {
  margin: 0;
}
h1 {
  font-size: clamp(1.75rem, 3.5vw, 2.85rem);
  line-height: 1.15;
  letter-spacing: -0.045em;
}
h2 {
  font-size: 1.24rem;
  line-height: 1.35;
  letter-spacing: -0.018em;
}
h3 {
  font-size: 1.02rem;
}
.muted,
small,
.sub {
  color: var(--muted);
}
small,
.sub {
  font-size: 0.86rem;
}
.shell {
  display: grid;
  grid-template-columns: 228px minmax(0, 1fr);
  min-height: 100dvh;
}
aside {
  background: #eaf0e8;
  border-right: 1px solid var(--line);
  padding: 29px 18px;
  display: flex;
  flex-direction: column;
  gap: 27px;
  position: sticky;
  top: 0;
  height: 100dvh;
}
.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 760;
  letter-spacing: -0.055em;
  font-size: 1.37rem;
  text-decoration: none;
  color: var(--pine);
}
.mark {
  width: 34px;
  height: 36px;
  display: inline-grid;
  place-items: center;
  color: white;
  border-radius: 7px 14px 7px 14px;
  background: var(--pine);
  font:
    italic 700 20px Georgia,
    serif;
}
.nav {
  display: grid;
  gap: 4px;
}
.nav a,
.bottom a,
.mobile-head a {
  color: var(--ink);
  text-decoration: none;
}
.nav a {
  display: flex;
  align-items: center;
  gap: 0.72rem;
  min-height: 44px;
  padding: 0.55rem 0.7rem;
  border-radius: 0.55rem;
  font-size: 0.93rem;
}
.nav a.active,
.bottom a.active {
  color: var(--green);
  background: #dbe6d9;
  font-weight: 750;
}
.nav a:hover {
  background: #dfe9dc;
}
.ico {
  width: 21px;
  height: 21px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.userbox {
  margin-top: auto;
  border-top: 1px solid var(--line);
  padding-top: 15px;
  display: grid;
  gap: 10px;
}
.userbox strong {
  font-size: 0.95rem;
}
.area {
  min-width: 0;
}
.top {
  margin: auto;
  max-width: 1630px;
  padding: 18px clamp(18px, 3.5vw, 58px);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  min-height: 63px;
}
.top span {
  color: var(--muted);
  font-size: 0.9rem;
}
.topbtn {
  min-height: 38px;
  font-size: 0.84rem;
  padding: 0.35rem 0.8rem;
}
.mobile-head,
.bottom {
  display: none;
}
main.content {
  max-width: 1630px;
  padding: clamp(17px, 3.5vw, 54px);
  margin: 0 auto;
}
.heading,
.row,
.spread {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.heading,
.spread {
  justify-content: space-between;
}
.heading {
  margin-bottom: 23px;
}
.heading p {
  margin-top: 5px;
}
.stack {
  display: grid;
  gap: 15px;
}
.grid2,
.pair,
.kpis {
  display: grid;
  gap: 16px;
}
.grid2 {
  grid-template-columns: minmax(0, 1.45fr) minmax(270px, 0.8fr);
}
.pair {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.kpis {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 18px;
}
.box,
.metric,
.hero,
.authbox {
  border: 1px solid var(--line);
  border-radius: 1.05rem;
  padding: clamp(16px, 2.1vw, 30px);
  background: var(--white);
  min-width: 0;
}
.box h2,
.box h3 {
  margin-bottom: 8px;
}
.metric {
  display: grid;
  align-content: space-between;
  gap: 9px;
}
.metric strong {
  font-size: clamp(1.5rem, 2.7vw, 2.65rem);
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.055em;
}
.metric span {
  font-size: 0.89rem;
  font-weight: 650;
}
.metric.highlight {
  background: var(--pine);
  border-color: var(--pine);
  color: #fff;
}
.metric.highlight .sub {
  color: #d8e9dd;
}
.neg {
  color: var(--red);
}
.hero {
  background: #e3eddf;
}
.hero h2 {
  font-size: 1.55rem;
}
.chip {
  border-radius: 6px;
  padding: 0.22rem 0.56rem;
  background: #e8efe7;
  color: #315647;
  display: inline-block;
  font-weight: 650;
  font-size: 0.78rem;
}
.chip.warn {
  background: #faeedc;
  color: #784412;
}
.chart {
  height: 155px;
  width: 100%;
  display: block;
  overflow: visible;
}
.chart text {
  fill: var(--muted);
  font-size: 11px;
}
.axes {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--muted);
}
.list {
  display: grid;
  gap: 0;
}
.item {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
  border: 0;
  border-bottom: 1px solid #e1e8df;
  border-radius: 0;
  min-height: 55px;
  padding: 0.65rem 0;
  text-align: start;
  background: transparent;
  text-decoration: none;
  color: var(--ink);
  width: 100%;
  font-weight: 400;
}
.item:last-child {
  border-bottom: 0;
}
.item > span:first-child {
  min-width: 0;
}
.item strong,
.item small {
  display: block;
  overflow-wrap: anywhere;
}
.item .money {
  white-space: nowrap;
  text-align: end;
  font-variant-numeric: tabular-nums;
}
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}
.filters input {
  flex: 1 1 190px;
}
.filters select {
  width: auto;
  max-width: 100%;
}
.field {
  display: grid;
  gap: 4px;
  font-size: 0.9rem;
  font-weight: 650;
}
.field small {
  font-weight: 400;
}
input,
select,
textarea {
  max-width: 100%;
  width: 100%;
  min-height: 45px;
  padding: 0.58rem 0.7rem;
  border: 1px solid #b9c7b9;
  border-radius: 0.55rem;
  background: white;
}
textarea {
  min-height: 84px;
  resize: vertical;
}
input[type='checkbox'] {
  height: 18px;
  width: 18px;
  min-height: 18px;
  accent-color: var(--green);
}
input[type='file'] {
  font-size: 0.9rem;
}
.tick {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 0.9rem;
}
.checkrow {
  padding: 8px 0;
  border-top: 1px solid var(--line);
}
.caseAmount {
  font-size: clamp(1.8rem, 5vw, 3rem);
  font-weight: 730;
  letter-spacing: -0.055em;
}
.parties {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  flex-wrap: wrap;
  font-size: 0.94rem;
}
.actions {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}
.choices {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(125px, 1fr));
  gap: 0.45rem;
}
.choice {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.52rem;
  min-height: 45px;
  border: 1px solid var(--line);
  border-radius: 0.55rem;
  padding: 0.55rem 0.7rem;
  cursor: pointer;
  font-size: 0.88rem;
}
.choice:has(input:checked) {
  border-color: var(--green);
  background: var(--sage);
  color: var(--green);
}
.choice input {
  width: 16px;
  min-height: 16px;
  height: 16px;
  accent-color: var(--green);
  flex: none;
}
.tablewrap {
  overflow: auto;
}
.tablewrap table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.9rem;
}
.tablewrap td,
.tablewrap th {
  padding: 0.55rem;
  border-bottom: 1px solid var(--line);
  text-align: start;
  vertical-align: top;
}
.tablewrap th {
  color: var(--muted);
  font-weight: 600;
}
.detailgrid {
  display: grid;
  grid-template-columns: minmax(130px, 0.7fr) minmax(0, 1.5fr);
  gap: 0.35rem 1rem;
  font-size: 0.9rem;
}
.detailgrid div {
  overflow-wrap: anywhere;
}
.detailgrid div:nth-child(odd) {
  color: var(--muted);
}
details {
  border-top: 1px solid var(--line);
  padding: 0.6rem 0;
}
summary {
  cursor: pointer;
  font-weight: 650;
  min-height: 36px;
}
.authwrap {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  background: #edf2ea;
  padding: 18px;
  padding: max(18px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) max(18px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
}
.install-help {
  border-top: 1px solid var(--line);
  color: var(--muted);
}
.install-help summary {
  padding: .7rem 0;
  min-height: 44px;
  cursor: pointer;
  color: var(--green);
  font-weight: 650;
}
.install-help p { margin: .4rem 0 .75rem; }
.install-help[hidden], .install-help button[hidden] { display: none; }
.authbox {
  max-width: 420px;
  width: 100%;
  display: grid;
  gap: 18px;
  padding: clamp(21px, 4vw, 36px);
}
.authbox h1 {
  font-size: 1.9rem;
}
.authbox .logo {
  margin-bottom: 6px;
}
.authbox img {
  width: 155px;
  height: 155px;
}
.authbox code {
  overflow-wrap: anywhere;
}
.authbox .topbtn {
  justify-self: start;
}
.empty {
  padding: 18px;
  background: var(--sage);
  border-radius: 0.65rem;
  font-size: 0.94rem;
}
.err {
  padding: 10px;
  background: #fbece3;
  color: #752d15;
  border-radius: 0.55rem;
}
.error-focus {
  color: #853927;
}
#notice:not(:empty) {
  position: fixed;
  bottom: max(20px, env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  background: var(--pine);
  color: white;
  padding: 10px 17px;
  border-radius: 10px;
  max-width: 90%;
  box-shadow: 0 3px 20px #1233;
}
.skip {
  position: absolute;
  left: -999px;
}
.skip:focus {
  left: 8px;
  top: 8px;
  z-index: 8;
  background: white;
}
.loading {
  text-align: center;
  margin: 15vh auto;
}
.links {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.progress {
  font-size: 0.86rem;
  color: var(--green);
  font-weight: 650;
}
.textlink {
  background: transparent;
  border: 0;
  color: var(--green);
  padding: 0.28rem 0.4rem;
}
.quiet {
  border: 0;
  color: var(--muted);
  background: transparent;
}
.ledgerrow {
  margin: 5px 0;
}
.foldericon {
  color: var(--green);
}
.tagline {
  font-size: 0.88rem;
  color: var(--muted);
  margin-bottom: 9px;
}
.number {
  font-variant-numeric: tabular-nums;
}
.file-actions {
  display: flex;
  gap: 7px;
  align-items: center;
  flex-wrap: wrap;
}
@media (max-width: 1050px) {
  .shell {
    grid-template-columns: 185px minmax(0, 1fr);
  }
  aside {
    padding: 22px 10px;
  }
  .grid2 {
    grid-template-columns: minmax(0, 1.15fr) minmax(260px, 0.85fr);
  }
}
@media (max-width: 800px) {
  .shell {
    display: block;
  }
  aside,
  .top {
    display: none;
  }
  .mobile-head {
    min-height: calc(60px + env(safe-area-inset-top));
    padding: calc(9px + env(safe-area-inset-top)) max(15px, env(safe-area-inset-right)) 9px max(15px, env(safe-area-inset-left));
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #edf2eb;
    border-bottom: 1px solid var(--line);
  }
  .mobile-head .logo {
    font-size: 1.14rem;
  }
  .mobile-head .mark {
    width: 28px;
    height: 31px;
    font-size: 17px;
  }
  .bottom {
    display: flex;
    justify-content: space-around;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: #fcfdf9;
    border-top: 1px solid var(--line);
    padding: 4px 3px max(5px, env(safe-area-inset-bottom));
    z-index: 5;
  }
  .bottom a {
    display: flex;
    flex: 1;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1px;
    min-height: 46px;
    max-width: 92px;
    font-size: 0.7rem;
    border-radius: 6px;
  }
  .bottom .ico {
    width: 19px;
    height: 19px;
  }
  .grid2 {
    grid-template-columns: 1fr;
  }
  .kpis {
    gap: 8px;
    grid-template-columns: 1fr 1fr;
  }
  .kpis .metric:first-child {
    grid-column: 1/-1;
  }
  .metric {
    padding: 13px 15px;
  }
  .metric.highlight {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
  }
  .metric.highlight .sub {
    grid-column: 1/-1;
  }
  .heading {
    margin-bottom: 15px;
  }
  .content {
    padding-bottom: 90px !important;
  }
  .topbtn {
    min-height: 42px;
  }
  .chart {
    height: 138px;
  }
  #notice:not(:empty) {
    bottom: 76px;
  }
  .box,
  .hero {
    padding: 16px;
  }
  .pair {
    gap: 9px;
  }
}
@media (max-width: 480px) {
  .heading .actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
  }
  .heading .actions:has(> :only-child) {
    grid-template-columns: 1fr;
  }
  .actions > button {
    flex: 1 1 auto;
  }
  .pair {
    grid-template-columns: 1fr;
  }
  .filters > * {
    max-width: 100%;
  }
  #portfolio-dates,
  #reportdates {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
  }
  .filters .field {
    grid-template-columns: minmax(0, 1fr);
    min-width: 0;
  }
  .filters input[type='date'] {
    -webkit-appearance: none;
    appearance: none;
    box-sizing: border-box;
    min-width: 0;
    display: block;
  }
  .form-pair {
    grid-template-columns: 1fr;
  }
  .choices {
    grid-template-columns: 1fr 1fr;
  }
  .box {
    border-radius: 0.8rem;
  }
  .userbox {
    gap: 7px;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
  }
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  min-height: 0;
}
.camera:focus-within {
  outline: 3px solid #b97d36;
}
.camera {
  justify-self: start;
}
.scope-list,
.months {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr));
  gap: 8px;
}
.scope-link,
.months a {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  min-height: 46px;
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: white;
  text-decoration: none;
  overflow-wrap: anywhere;
}
.scope-list [aria-current],
.months [aria-current] {
  background: #205348;
  color: white;
  border-color: #205348;
  font-weight: 650;
}
.scope-list [aria-current] small {
  color: inherit;
}
.months {
  grid-template-columns: repeat(auto-fit, minmax(64px, 1fr));
}
.file-choices {
  max-height: 16rem;
  overflow: auto;
}
.file-choices label {
  min-height: 44px;
}
.check {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  overflow-wrap: anywhere;
}
.check input {
  width: 20px;
  min-height: 20px;
  flex: 0 0 20px;
}
.grid2:has(.caseAmount) {
  align-items: start;
}
hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 14px 0;
}
.export-ref { overflow-wrap: anywhere; }
.device-choice { display: flex; gap: .65rem; align-items: center; min-height: 44px; }
.device-choice input { flex: none; width: 20px; height: 20px; min-height: 0; }
.source-facts { display: grid; grid-template-columns: minmax(8rem, 1fr) minmax(0, 2fr); gap: .55rem 1rem; }
.source-facts dt { color: var(--muted); }
.source-facts dd { margin: 0; overflow-wrap: anywhere; }
.content h1 { overflow-wrap: anywhere; }
aside { overflow-y: auto; }
@media (max-width: 600px) {
  .source-facts { grid-template-columns: 1fr; gap: .15rem; }
  .source-facts dd { margin-bottom: .6rem; }
}
