:root {
  color-scheme: light;
  --ink: #16312c;
  --subtle: #4a665e;
  --paper: #f5f8f6;
  --white: #fff;
  --line: #cedbd4;
  --pine: #135645;
  --mint: #dfede5;
  --warning: #913f20;
  font: 16px/1.58 "DM Sans", "Microsoft YaHei UI", "PingFang SC", system-ui, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; color: var(--ink); background: var(--paper); }
a { color: var(--pine); text-underline-offset: .25em; }
a:hover { text-decoration-thickness: 2px; }
button, input, select, textarea { font: inherit; }
button, select { cursor: pointer; }
button:disabled { cursor: wait; opacity: .65; }
button, input, select, textarea, a { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid #267058; outline-offset: 3px; }
.shell { width: min(1100px, calc(100% - 64px)); margin-inline: auto; }
.masthead { border-bottom: 1px solid var(--line); background: var(--white); }
.masthead-inner, .profile-rail, .intro, .section-head, .dialog-head, .dialog-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.masthead-inner { min-height: 68px; }
.brand { display: inline-flex; align-items: center; gap: .65em; text-decoration: none; font-size: 1.1rem; font-weight: 720; color: var(--ink); }
.brand-mark { display: grid; place-items: center; width: 31px; height: 31px; border-radius: 8px 8px 8px 2px; color: white; background: var(--pine); line-height: 1; font-size: 1.25rem; }
h1, h2, h3, p { margin-block: 0; }
h1 { font-size: clamp(1.8rem, 5vw, 3rem); font-weight: 750; line-height: 1.15; overflow-wrap: anywhere; }
h2 { font-size: 1.2rem; line-height: 1.35; }
h3 { font-size: 1rem; line-height: 1.38; overflow-wrap: anywhere; }
.muted { color: var(--subtle); font-size: .89rem; }
.error { color: var(--warning); font-size: .9rem; white-space: pre-line; }
.error:empty { display: none; }
button { border: 1px solid transparent; min-height: 44px; border-radius: 8px; padding: .5em .95em; font-weight: 650; }
.primary { background: var(--pine); color: white; }
.primary:hover { background: #194537; }
.secondary { color: var(--ink); background: var(--white); border-color: var(--line); }
.secondary:hover, .quiet:hover { background: var(--mint); }
.quiet { background: transparent; color: var(--pine); }
.login-panel { width: min(100%, 455px); margin: clamp(32px, 9vh, 98px) 0 64px; padding: clamp(20px, 4vw, 34px); border-top: 4px solid var(--pine); border-radius: 0 0 13px 13px; background: var(--white); box-shadow: 0 1px 0 var(--line); }
.login-panel h1 { font-size: clamp(1.5rem, 5vw, 2rem); margin-bottom: 1.25rem; }
.login-panel button { margin-top: 14px; }
.profile-rail { padding-block: 18px; border-bottom: 1px solid var(--line); }
.profiles, .intro-actions, .filters, .record-actions, .header-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.header-actions { gap: 2px; justify-content: flex-end; }
.header-actions button { padding-inline: .55em; font-size: .89rem; }
#device .muted { margin-top: 8px; }
.profiles button, .filters button { background: transparent; color: var(--subtle); border: 1px solid transparent; font-size: .9rem; }
.profiles button[aria-pressed="true"], .filters button[aria-pressed="true"] { color: var(--pine); background: var(--mint); border-color: #bdd2c7; }
.profiles button { max-width: 10em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.intro { padding: 34px 0 30px; }
.intro p { margin-top: 8px; }
.columns { display: grid; grid-template-columns: minmax(0, 1fr) minmax(230px, 29%); gap: clamp(20px, 4vw, 47px); padding-bottom: 65px; }
.timeline { min-width: 0; }
.section-head { margin-bottom: 10px; }
.filters { gap: 2px; margin-bottom: 12px; }
.filters button { padding-inline: .55em; font-weight: 600; }
.record { display: grid; grid-template-columns: 84px minmax(0, 1fr); gap: 12px; align-items: start; border-top: 1px solid var(--line); padding: 15px 0; }
.record time { font-size: .8rem; color: var(--subtle); overflow-wrap: anywhere; }
.record-kind { font-size: .8rem; color: var(--pine); margin-bottom: 3px; font-weight: 650; }
.record-fields { margin: .4rem 0 0; display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: .1em .6em; font-size: .91rem; }
.record-fields dt { color: var(--subtle); }
.record-fields dd { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.record-actions { margin-top: 7px; gap: .25rem; }
.record-actions button { font-size: .82rem; padding: .35em .55em; }
.record-actions a { display: inline-flex; align-items: center; min-height: 44px; margin-right: .5em; font-size: .85rem; overflow-wrap: anywhere; }
.empty { padding: 1.25em 1.1em; border: 1px dashed #aebfb7; border-radius: 8px; background: var(--white); color: var(--subtle); }
.side-block { border-top: 1px solid var(--line); padding: 1rem 0 1.1rem; }
.side-block h2 { margin: 0 0 .6rem; }
.side-block ul { margin: .35em 0 0; padding-left: 1.1em; font-size: .92rem; }
.side-block li { margin-bottom: .3rem; overflow-wrap: anywhere; }
.text-link { display: inline-block; margin-block: 10px; }
label { display: grid; gap: .28rem; font-weight: 650; font-size: .91rem; margin-top: .75rem; }
input, select, textarea { min-height: 44px; width: 100%; padding: .5rem .65rem; border: 1px solid #9eb4a8; border-radius: 7px; color: var(--ink); background: white; font-weight: 400; }
textarea { resize: vertical; }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 12px; }
.field-grid .wide { grid-column: 1 / -1; }
dialog { position: fixed; color: var(--ink); width: min(620px, calc(100% - 26px)); max-height: min(89dvh, 860px); border: 1px solid var(--line); border-radius: 14px; padding: 18px 22px; box-shadow: 0 18px 44px #16312c29; }
dialog::backdrop { background: #0d2b23a8; }
.dialog-head { position: sticky; top: -18px; background: white; border-bottom: 1px solid var(--line); z-index: 1; }
.dialog-foot { justify-content: flex-end; margin-top: 14px; }
.dialog-foot button { min-width: 80px; }
#visit-sheet { margin: 18px 0 10px; padding: 16px; border: 1px solid var(--line); border-radius: 7px; overflow-wrap: anywhere; }
#visit-sheet h3 { margin: 12px 0 4px; }
#visit-sheet ul, #visit-sheet ol { padding-left: 1.2rem; margin: 0; }
#visit-sheet p, #visit-sheet li { white-space: pre-wrap; }
.urgent { color: var(--warning); margin: 10px 0; padding: .55em .75em; border-left: 3px solid var(--warning); background: #fff2eb; font-size: .9rem; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
@media (max-width: 695px) {
  .shell { width: calc(100% - 32px); }
  .masthead-inner { min-height: 60px; }
  .intro { align-items: stretch; flex-direction: column; padding: 24px 0 22px; }
  .intro-actions { margin-top: 4px; }
  .intro-actions button { flex: 1 1 auto; }
  .columns { grid-template-columns: minmax(0, 1fr); gap: 26px; }
  .record { grid-template-columns: 68px minmax(0, 1fr); gap: 8px; }
  .record-fields { grid-template-columns: auto minmax(0, 1fr); }
  dialog { padding-inline: 13px; }
}
@media print {
  body { background: white; color: black; }
  body > :not(#visit), #visit::backdrop, #visit .dialog-head button, .no-print { display: none !important; }
  #visit { position: static; width: 100%; max-width: none; max-height: none; border: none; border-radius: 0; box-shadow: none; padding: 0; overflow: visible; }
  #visit-sheet { margin: 0; padding: 8px 0; border: 0; font-size: 11pt; }
  #visit-sheet h3 { break-after: avoid; }
}
