:root {
  color-scheme: light;
  font-family: "Hiragino Sans", "Yu Gothic", Meiryo, system-ui, sans-serif;
  color: #202e39;
  background: #f4f6f8;
  --ink: #202e39;
  --muted: #526574;
  --line: #dbe3e8;
  --accent: #17665c;
  --accent-soft: #e5f3ef;
  --warn: #874510;
}
* { box-sizing: border-box; }
body { margin: 0; font-size: 14px; line-height: 1.55; }
.wrap { width: min(1440px, calc(100% - 64px)); margin-inline: auto; }
.top { background: #142b35; color: #fff; }
.brand { display: flex; align-items: center; gap: 12px; padding-block: 19px 14px; font-size: 19px; font-weight: 750; }
.brand small { font-weight: 500; margin-left: 12px; color: #c0d0d7; }
.mark { display: grid; place-items: center; width: 37px; height: 37px; border-radius: 10px; color: #173a36; background: #a6e6d5; }
.badge { font-weight: 650; font-size: 11px; color: #d6efe8; background: #28444c; padding: 4px 10px; border-radius: 20px; margin-left: auto; white-space: nowrap; }
nav { display: flex; gap: 8px; overflow-x: auto; padding-block: 2px 0; }
nav button { border: 0; border-radius: 8px 8px 0 0; background: transparent; color: #dce7ec; padding: 11px 15px; white-space: nowrap; }
nav button.active { background: #f4f6f8; color: var(--accent); }
nav button:hover:not(.active) { background: #28444c; }
main { padding-bottom: 48px; }
.page-head { display: flex; justify-content: space-between; align-items: end; gap: 20px; margin: 29px 0 21px; }
.page-head p { margin: 5px 0 0; color: var(--muted); }
h1, h2, h3 { margin: 0; line-height: 1.35; }
h1 { font-size: clamp(23px, 3vw, 31px); letter-spacing: .02em; }
h2 { font-size: 17px; margin-bottom: 13px; }
h3 { margin: 18px 0 8px; }
.panel { background: white; border: 1px solid var(--line); border-radius: 12px; padding: 19px; min-width: 0; margin-bottom: 15px; box-shadow: 0 2px 5px #24364a06; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.visit-layout, .docs-layout, .metrics { display: grid; gap: 15px; align-items: start; }
.visit-layout { grid-template-columns: minmax(320px, .85fr) minmax(0, 1.5fr); }
.docs-layout { grid-template-columns: minmax(220px, .65fr) minmax(0, 2fr); }
.metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: stretch; }
.metrics strong { font-size: 22px; color: var(--accent); font-variant-numeric: tabular-nums; }
.metrics p { margin: 6px 0 1px; color: var(--muted); }
.metrics button { margin-top: 9px; }
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
label, legend { font-weight: 650; font-size: 13px; }
form > label, .fields label { display: block; margin-bottom: 9px; }
input, select, textarea, button { font: inherit; color: inherit; }
input:not([type=checkbox]), select, textarea { width: 100%; min-width: 0; background: white; border: 1px solid #bdcbd2; border-radius: 7px; padding: 7px 9px; display: block; margin-top: 4px; }
input:disabled { background: #edf0f2; }
input[type=checkbox] { accent-color: var(--accent); }
textarea { resize: vertical; }
fieldset { border: 1px solid var(--line); border-radius: 8px; margin: 0 0 9px; padding: 5px 9px 8px; }
.choices, .toolbar, .actions { display: flex; flex-wrap: wrap; gap: 8px 13px; align-items: end; }
.choices label, .check { display: inline-flex; gap: 5px; align-items: center; }
.check { min-height: 38px; }
.req { color: #a33733; font-size: 11px; }
button { background: white; border: 1px solid #bccbd1; border-radius: 7px; padding: 7px 11px; cursor: pointer; font-weight: 650; }
button:hover:not(:disabled) { background: #edf5f3; }
button:disabled { opacity: .52; cursor: default; }
.primary { background: var(--accent); color: white; border-color: var(--accent); }
.primary:hover:not(:disabled) { background: #12564d; }
:focus-visible { outline: 2px solid #07877d; outline-offset: 2px; }
.text-button { border: 0; padding: 2px 4px; color: var(--accent); }
form .text-button { margin: -4px 0 8px; font-size: 12px; }
.back { margin-bottom: 12px; }
.row-actions { white-space: nowrap; }
.row-actions button { padding: 4px 7px; margin-right: 4px; font-size: 12px; }
.danger, .error { color: #a12c30; }
.error:empty { display: none; }
.month { flex: 0 0 155px; }
.toolbar { margin-bottom: 12px; }
.toolbar label { min-width: 115px; }
.table-scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; text-align: left; font-size: 13px; }
th, td { padding: 9px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
thead { background: #eef3f5; color: #354d5b; white-space: nowrap; }
.total { background: var(--accent-soft); font-weight: 700; }
.money { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.pill { display: inline-block; font-size: 11px; font-weight: 700; color: #405462; background: #edf2f5; padding: 3px 8px; border-radius: 14px; margin: 1px 3px 1px 0; white-space: nowrap; }
.good { color: #165c4d; background: var(--accent-soft); }
.warn { color: var(--warn); background: #fff0d8; }
.muted, small, .empty { color: var(--muted); }
.brand small { color: #c0d0d7; }
.empty { padding: 13px; border: 1px dashed var(--line); border-radius: 7px; }
summary { cursor: pointer; font-weight: 700; color: var(--accent); }
details .table-scroll { margin-top: 8px; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(155px, 1fr)); gap: 10px 14px; }
.facts dt { color: var(--muted); font-size: 12px; }
.facts dd { margin: 2px 0 0; overflow-wrap: anywhere; }
.doc-item { text-align: left; width: 100%; display: grid; justify-items: start; gap: 2px; margin-bottom: 6px; }
.doc-item.selected { background: var(--accent-soft); border-color: var(--accent); }
.preview .toolbar { align-items: center; }
.paper { border: 1px solid var(--line); background: white; padding: 22px; }
.paper-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: start; gap: 6px; }
.paper-head p { margin: 0 0 4px; color: var(--warn); font-size: 11px; }
.paper-head small { overflow-wrap: anywhere; }
.recipient { font-size: 17px; font-weight: 700; }
.paper-amount { background: #eef5f3; padding: 9px 13px; }
.paper-amount strong { margin-left: 12px; font-size: 19px; }
.paper-foot { color: var(--muted); font-size: 11px; }
.output-pending { padding: 8px; background: var(--accent-soft); margin-bottom: 12px; align-items: center; }
.output-pending p { margin: 0; }
#notice:not(:empty) { position: fixed; bottom: 16px; right: 16px; max-width: calc(100% - 32px); padding: 10px 18px; border-radius: 8px; background: #142b35; color: white; box-shadow: 0 3px 15px #142b3538; }
#print-area { display: none; }
@media (max-width: 850px) {
  .wrap { width: calc(100% - 30px); }
  .visit-layout, .docs-layout { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 620px) {
  .metrics { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .page-head { flex-direction: column; align-items: stretch; gap: 10px; }
  .month { flex: auto; align-self: start; }
  .brand small { display: block; margin: 0; }
  .panel, .paper { padding: 12px; }
}
@media print {
  @page { size: A4; margin: 14mm; }
  body { background: white; font-size: 10pt; }
  body > :not(#print-area) { display: none !important; }
  #print-area { display: block; }
  .paper { padding: 0; border: 0; }
  .paper + .paper { break-before: page; }
  .paper tr { break-inside: avoid; }
  .paper th, .paper td { padding: 4px 6px; }
  .paper .table-scroll { overflow: visible; }
}
