:root {
  color-scheme: light;
  font-family: Inter, "PingFang SC", "Microsoft YaHei UI", system-ui, sans-serif;
  color: #202824;
  background: #f5f6f2;
  --ink: #202824;
  --muted: #596660;
  --line: #dce3dc;
  --surface: #fff;
  --accent: #17604a;
  --wash: #e7f2ec;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; font-size: 15px; line-height: 1.55; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(24px, 4vw, 36px); line-height: 1.2; letter-spacing: -.03em; }
h2 { font-size: 16px; }
h3 { font-size: 15px; }
a { color: var(--accent); }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible {
  outline: 2px solid #258361;
  outline-offset: 2px;
}
button, input, select, textarea { font: inherit; }
button, input, select, textarea {
  min-height: 40px;
  border: 1px solid #cbd7ce;
  border-radius: 7px;
}
button { padding: 7px 14px; color: var(--ink); background: var(--surface); cursor: pointer; }
button:hover { background: var(--wash); }
button:disabled { cursor: default; opacity: .55; }
input, select, textarea { width: 100%; min-width: 0; padding: 8px 10px; color: var(--ink); background: var(--surface); }
textarea { resize: vertical; }
input[type=file] { font-size: 13px; }
label { display: grid; gap: 5px; font-size: 13px; font-weight: 600; }
.primary { color: white; background: var(--accent); border-color: var(--accent); }
.primary:hover { background: #104d3a; }
.quiet { border-color: transparent; background: transparent; color: var(--accent); }
.muted { color: var(--muted); }
.error { color: #9c2621; font-size: 13px; }
.error:empty { display: none; }

.topbar {
  min-height: 63px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 8px clamp(16px, 4vw, 40px);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.brand { flex-shrink: 0; color: var(--ink); font-size: 20px; font-weight: 730; text-decoration: none; letter-spacing: .06em; }
.brand span { color: var(--accent); margin-left: 4px; }
.identity { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; font-size: 13px; overflow-wrap: anywhere; }
.identity button { white-space: nowrap; }

.login { display: grid; justify-content: center; padding: clamp(32px, 12vh, 120px) 16px 32px; }
.card {
  display: grid; gap: 20px; width: min(380px, calc(100vw - 32px)); padding: 30px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
}
.card h1 { font-size: 25px; margin-bottom: 4px; }
.workspace { min-height: calc(100vh - 63px); display: grid; grid-template-columns: 244px minmax(0, 1fr); }
.sidebar { border-right: 1px solid var(--line); padding: 21px 15px; background: #f0f3ee; }
.side-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.side-heading button { padding-inline: 7px; font-size: 13px; white-space: nowrap; }
.sidebar nav { display: grid; gap: 5px; }
.account-link {
  color: var(--ink); text-decoration: none; display: flex; justify-content: space-between; align-items: center;
  gap: 8px; padding: 9px 11px; border-radius: 7px; overflow-wrap: anywhere;
}
.account-link small { color: var(--muted); flex-shrink: 0; font-size: 11px; }
.account-link:hover, .account-link[aria-current=page] { background: #dfece4; }
.account-link[aria-current=page] { color: #124e39; font-weight: 680; }
.content { padding: clamp(18px, 4vw, 52px); width: 100%; max-width: 1320px; }
.notice { padding: 10px 12px; background: var(--wash); border: 1px solid #bcd7c7; border-radius: 7px; margin-bottom: 16px; }
.empty { padding: 45px 0; }
.empty p { margin-top: 12px; color: var(--muted); }
.account-heading { display: flex; justify-content: space-between; gap: 16px; align-items: center; }
.account-heading h1 { overflow-wrap: anywhere; }
.account-heading button { flex-shrink: 0; }
.account-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: end; }
#remote-status { font-size: 13px; margin-top: 6px; }
.team-form, dialog .team-form {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: end; margin-block: 12px;
}
.team-form label { flex: 1 1 130px; min-width: 0; }
.team-form .checkbox { display: flex; align-items: center; min-height: 40px; gap: 5px; flex: 0 0 auto; }
.checkbox input { width: auto; min-height: 0; margin: 0; }
.team-list { padding-left: 20px; overflow-wrap: anywhere; }
.team-list li { margin-block: 7px; }
.team-list button { min-height: 30px; padding: 3px 7px; }
#remote-dialog { max-width: min(1280px, calc(100vw - 24px)); }
#remote-notice { min-height: 25px; margin-top: 6px; }
#remote-surface {
  min-height: 150px; width: 100%; max-height: 70vh; overflow: auto; background: #1d2824;
}
.account-heading .muted { font-size: 13px; margin-top: 9px; }
.platform { font-size: 12px; color: var(--accent); margin-bottom: 8px; }
.binding { margin: 12px 0 24px; font-size: 13px; color: var(--muted); }
.binding-field { display: flex; gap: 7px; max-width: 420px; margin-top: 8px; }
.reporter-form {
  display: flex; flex-wrap: wrap; gap: 7px; align-items: end; margin-top: 15px;
}
.reporter-form label { flex: 1 1 175px; max-width: 270px; }
#reporter-key-view { max-width: 525px; margin-top: 16px; }
#reporter-key-view label { margin-top: 5px; }
summary { cursor: pointer; }
.filter {
  display: grid; grid-template-columns: minmax(150px, 1.5fr) minmax(110px, 1fr) repeat(2, minmax(128px, .85fr)) auto;
  gap: 9px; align-items: end; padding: 13px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface);
}
.result-state { margin: 16px 0 7px; font-size: 13px; }
.messages { margin: 0; padding: 0; list-style: none; }
.message {
  display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 14px; padding: 14px 13px;
  border-top: 1px solid var(--line); overflow-wrap: anywhere;
}
.message:last-child { border-bottom: 1px solid var(--line); }
.message-meta { display: grid; align-content: start; gap: 3px; font-size: 12px; color: var(--muted); }
.message-meta strong { font-size: 13px; color: var(--ink); }
.message-text { white-space: pre-wrap; }
.attachments { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 9px; }
.attachments a { display: inline-block; border: 1px solid var(--line); border-radius: 6px; padding: 4px 8px; font-size: 13px; }
.load-more { margin-top: 12px; }
.batches { margin-top: 24px; font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.batches ul { padding-left: 20px; }
.batches li { margin-block: 7px; }

dialog {
  max-width: min(540px, calc(100vw - 24px)); width: 100%; max-height: 92vh; padding: 21px;
  background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 12px;
}
dialog::backdrop { background: #16231d63; }
dialog form { display: grid; gap: 14px; }
.dialog-heading { display: flex; align-items: center; justify-content: space-between; }
.dialog-heading h2 { font-size: 20px; }
.close { font-size: 23px; padding: 0 11px; }
dialog footer { display: flex; justify-content: flex-end; gap: 8px; }
.hint { font-size: 12px; margin-top: -8px; }
.date-options { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.preview { padding: 10px 12px; background: var(--wash); border-radius: 7px; font-size: 13px; overflow-wrap: anywhere; }
.preview ul { margin: 6px 0 0; padding-left: 16px; }
.preview li { white-space: pre-wrap; }

.topbar-link { padding: 9px 12px; border-radius: 7px; text-decoration: none; white-space: nowrap; }
.topbar-link:hover, .topbar-link[aria-current=page] { background: var(--wash); }
#moments-view { width: min(900px, 100%); margin-inline: auto; padding: clamp(18px, 4vw, 36px); }
.moments-page-heading { display: flex; align-items: end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 24px; }
.moments-page-heading a { display: inline-block; margin-bottom: 9px; font-size: 13px; }
.moments-page-heading .muted { font-size: 13px; }
#moments-history, #moments-form {
  padding: clamp(14px, 3vw, 24px); background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
}
#moments-empty, #moments-result:not(:empty), #moments-error:not(:empty) { margin-block: 10px; }
#moments-fields { display: grid; gap: 14px; min-width: 0; padding: 0; margin: 12px 0; border: 0; }
#moments-fields .checkbox { display: flex; align-items: center; gap: 6px; }
#moments-fields footer { display: flex; justify-content: end; gap: 8px; flex-wrap: wrap; }
.moments-toolbar, .moment-meta { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; }
.moment-targets { min-width: 0; margin: 0; padding: 8px 10px; border: 1px solid var(--line); border-radius: 7px; }
.moment-targets legend { padding-inline: 4px; font-size: 13px; font-weight: 600; }
#moments-accounts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(170px, 100%), 1fr)); gap: 8px; max-height: 150px; overflow: auto; }
#moments-accounts label { min-width: 0; overflow-wrap: anywhere; }
#moments-list { list-style: none; margin: 0; padding: 0; }
#moments-list li { padding: 20px 0; border-bottom: 1px solid var(--line); }
#moments-list li:last-child { border-bottom: 0; }
.moment-body { white-space: pre-wrap; overflow-wrap: anywhere; }
.moment-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
#moments-edit-images { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 10px; padding: 0; margin: 0; list-style: none; }
#moments-edit-images li { display: grid; gap: 5px; }
#moments-edit-images img { width: 100%; aspect-ratio: 1; object-fit: contain; background: #f0f3ee; border: 1px solid var(--line); border-radius: 6px; }
#moments-edit-images button { min-height: 32px; padding-block: 3px; font-size: 13px; }
.moments-post { display: grid; grid-template-columns: 42px minmax(0, 1fr); gap: 12px; max-width: 640px; }
.moments-avatar {
  display: grid; place-items: center; width: 42px; height: 42px; border-radius: 5px; color: #395d4c;
  background: #e5eee8; font-weight: 680;
}
.moments-post-content { display: grid; gap: 7px; min-width: 0; }
.moments-post-author { color: #52678a; font-weight: 680; overflow-wrap: anywhere; }
select.moments-post-author { width: fit-content; max-width: 100%; min-height: 32px; padding: 3px 7px; }
.moments-post-time { font-size: 12px; color: var(--muted); }
.moments-post-images { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; max-width: 306px; }
.moments-post-images:is([data-count="2"], [data-count="4"]) { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 202px; }
.moments-post-images[data-count="1"] { grid-template-columns: minmax(0, 1fr); max-width: 270px; }
.moments-post-images img { width: 100%; aspect-ratio: 1; object-fit: cover; background: #f0f3ee; }
.moments-post-images[data-count="1"] img { aspect-ratio: 4 / 3; object-fit: contain; }

@media (max-width: 1100px) {
  .filter { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .filter .keyword { grid-column: span 2; }
}
@media (max-width: 680px) {
  .workspace { grid-template-columns: minmax(0, 1fr); align-content: start; }
  .sidebar { padding: 8px 12px; border-right: 0; border-bottom: 1px solid var(--line); }
  .side-heading { margin-bottom: 4px; }
  .sidebar nav { display: flex; overflow-x: auto; padding-bottom: 3px; }
  .account-link { flex: 0 0 auto; max-width: 78vw; white-space: nowrap; }
  .account-link span { overflow: hidden; text-overflow: ellipsis; }
  .filter { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filter .keyword { grid-column: 1 / -1; }
  .filter button { grid-column: 2; }
  .message { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .message-meta { display: flex; flex-wrap: wrap; gap: 5px 9px; }
}
