:root {
  color-scheme: light;
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", system-ui, sans-serif;
  color: #142526;
  background: #f2f5f4;
  font-size: 16px;
  line-height: 1.45;
  --ink: #142526;
  --muted: #4d5f60;
  --line: #d8e0dd;
  --green: #1a604b;
  --green-dark: #114837;
  --paper: #fff;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .65; }
a, button, input, select, textarea { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid #267b67; outline-offset: 2px; }
h1, h2, h3, p { margin: 0; }
.wrap { width: min(100% - 36px, 1100px); margin-inline: auto; }
.masthead { background: #142526; color: white; }
.masthead-inner { display: flex; align-items: center; gap: 12px; min-height: 64px; }
.masthead h1 { font-size: clamp(21px, 4vw, 25px); font-weight: 700; }
.brand-mark {
  display: grid;
  place-items: center;
  flex: 0 0 40px;
  height: 36px;
  background: #d4eddd;
  border-radius: 5px;
  color: #194738;
  font-size: 14px;
  font-weight: 800;
}
.logout {
  margin-inline-start: auto;
  padding: 0 2px;
  min-height: 44px;
  border: 0;
  background: transparent;
  color: #e1efea;
  font-size: 14px;
}
.logout:hover { color: white; text-decoration: underline; }
.logout:focus-visible { outline-color: #d4eddd; }
main { padding-block: 16px 28px; }
.button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 4px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 6px;
  min-height: 44px;
  color: var(--ink);
  background: var(--paper);
  font-weight: 600;
  white-space: nowrap;
}
.button:hover { background: #edf3ef; }
.button.primary { background: var(--green); color: white; border-color: var(--green); }
.button.primary:hover { background: var(--green-dark); }
.sign-in {
  width: min(100%, 390px);
  margin: clamp(12px, 9vh, 100px) auto 0;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--paper);
}
.sign-in h2 { margin-bottom: 16px; font-size: 23px; }
.sign-in form { display: grid; gap: 10px; }
.sign-in form > label:first-child { font-weight: 700; }
.sign-in > p + button { margin-top: 12px; }
.sign-in .primary { margin-top: 2px; }
.remember { display: flex; align-items: center; min-height: 44px; gap: 8px; color: var(--muted); }
.remember input { accent-color: var(--green); width: 17px; height: 17px; margin: 0; }
input:not([type=checkbox]), select, textarea {
  min-width: 0;
  width: 100%;
  min-height: 44px;
  border: 1px solid #b7c9c2;
  border-radius: 6px;
  color: var(--ink);
  background: var(--paper);
  padding: 8px 11px;
}
input::placeholder { color: #596c69; }
.toolbar { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.search { position: relative; min-width: 0; }
.search input { padding-left: 37px; }
.search-icon {
  pointer-events: none;
  position: absolute;
  left: 14px;
  top: 14px;
  width: 14px;
  height: 14px;
  border: 2px solid #526d66;
  border-radius: 50%;
}
.search-icon::after {
  position: absolute;
  content: "";
  width: 6px;
  height: 2px;
  background: #526d66;
  border-radius: 1px;
  right: -5px;
  bottom: -2px;
  transform: rotate(45deg);
}
.filters { display: flex; flex-wrap: wrap; gap: 7px; margin-block: 10px 14px; }
.filter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 12px;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--paper);
  color: var(--ink);
}
.filter span { font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }
.filter[aria-pressed=true] { background: #dceee3; border-color: #a1c7b4; color: #154934; font-weight: 700; }
.filter[aria-pressed=true] span { color: #154934; }
.groups { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; align-items: start; }
.groups.single { grid-template-columns: minmax(0, 1fr); }
.group {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
}
.group-title {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f6f8f7;
  border-radius: 8px 8px 0 0;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  font-size: 20px;
  color: var(--ink);
}
.group-title::before { content: ""; flex: 0 0 5px; height: 19px; border-radius: 2px; background: #a06119; }
.group.water .group-title::before { background: #1e728c; }
.group-title small { font-size: 14px; font-weight: 500; color: var(--muted); }
.record { padding: 7px 12px 9px; }
.record + .record { border-top: 1px solid var(--line); }
.record-heading, .account-line { display: flex; align-items: center; gap: 8px; }
.record-heading h3 { font-size: 18px; overflow-wrap: anywhere; min-width: 0; }
.action {
  flex: 0 0 auto;
  border: 0;
  border-radius: 5px;
  background: transparent;
  padding: 0 6px;
  min-width: 44px;
  min-height: 44px;
  color: var(--green-dark);
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
}
.action:hover { background: #edf3ef; }
.edit { margin-inline-start: auto; }
.account-line {
  background: #f1f6f4;
  border: 1px solid #edf1ef;
  border-radius: 6px;
  padding-inline: 8px 2px;
  gap: 6px;
  min-height: 46px;
}
.account-line > span { font-size: 14px; color: var(--muted); flex-shrink: 0; }
.account-line strong {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 18px;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  letter-spacing: .012em;
}
.account-line button { margin-inline-start: auto; }
.badge {
  color: #704511;
  background: #fff2d9;
  border-radius: 4px;
  padding: 2px 5px;
  font-size: 14px;
  overflow-wrap: anywhere;
  max-width: 42%;
}
.record dl { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 2px 8px; margin: 6px 0 0; }
.record dt { color: var(--muted); font-size: 14px; align-self: baseline; }
.record dd { margin: 0; font-size: 16px; overflow-wrap: anywhere; white-space: pre-wrap; }
.empty { text-align: center; padding: 20px 10px; border: 1px dashed #b7c9c2; border-radius: 8px; }
.empty button { margin-top: 10px; }
dialog {
  width: min(100% - 24px, 510px);
  max-height: min(90vh, 760px);
  max-height: min(90dvh, 760px);
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
}
dialog::backdrop { background: #101e1ecc; }
dialog h2 { margin: 0 0 12px; font-size: 22px; }
.form-fields { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
.form-fields label { display: grid; align-content: start; gap: 4px; font-weight: 600; }
.form-fields label > * { font-weight: 400; }
.form-fields .wide { grid-column: 1 / -1; }
.form-fields textarea { resize: vertical; }
.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  position: sticky;
  bottom: -16px;
  padding-block: 10px 3px;
  background: var(--paper);
}
.error { color: #a52220; font-size: 16px; }
#editor-error { margin-top: 7px; }
.toast {
  position: fixed;
  z-index: 2;
  right: max(12px, env(safe-area-inset-right));
  bottom: max(14px, env(safe-area-inset-bottom));
  max-width: calc(100% - 24px);
  background: #142526;
  color: white;
  padding: 10px 14px;
  border-radius: 6px;
}
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
@media (max-width: 720px) {
  .wrap { width: calc(100% - 20px); }
  .masthead-inner { min-height: 55px; }
  main { padding-top: 10px; }
  .directory-controls { position: sticky; top: 0; z-index: 1; padding: 4px 0 8px; background: #f2f5f4; }
  .directory-controls .filters { margin: 6px 0 0; }
  .groups { grid-template-columns: minmax(0, 1fr); }
  .group-title { padding-block: 6px; }
  .record { padding-block: 4px 7px; }
  .record .action { min-height: 40px; }
  .account-line { min-height: 42px; }
  .sign-in { padding: 18px; }
}
@media (max-width: 360px) {
  .toolbar { gap: 6px; }
  .toolbar .button { padding-inline: 7px; }
  .record { padding-inline: 9px; }
}
