:root {
  color-scheme: light;
  font-family: system-ui, -apple-system, "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  color: #152942;
  background: #f4f7fa;
  font-size: 16px;
  font-weight: 400;
  line-height: 1.55;
  --navy: #0c2844;
  --blue: #15579b;
  --blue-dark: #103f73;
  --ink: #152942;
  --muted: #4d6176;
  --border: #d9e3ec;
  --surface: #fff;
  --tint: #f2f7fc;
  --danger: #9b292d;
  --space: clamp(1rem, 4vw, 2.6rem);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; }
a { color: var(--blue); }
button, input, textarea, select { font: inherit; }
button, select { cursor: pointer; }
button:disabled, input:disabled { cursor: default; opacity: .60; }
a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 3px solid #2884d5;
  outline-offset: 2px;
}
p, h1, h2, h3, ul, ol, figure { margin: 0; }
h1, h2, h3 { line-height: 1.25; }
h1 { font-size: clamp(1.95rem, 5vw, 2.8rem); letter-spacing: -.035em; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.05rem; }
small, .subtle { color: var(--muted); }
small { line-height: 1.6; }
.skip-link { position: absolute; left: .75rem; top: -5rem; padding: .6rem 1rem; background: #fff; z-index: 4; }
.skip-link:focus { top: .75rem; }

.site-header { background: var(--navy); color: #fff; border-bottom: 4px solid #357eb9; }
.header-inner {
  min-height: 4.55rem;
  width: min(100%, 76rem);
  margin: 0 auto;
  padding: .6rem var(--space);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .65rem 1.25rem;
}
.brand { display: inline-flex; align-items: center; gap: .72rem; color: #fff; text-decoration: none; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 2.15rem;
  height: 2.15rem;
  background: #e8f2fc;
  border-radius: .43rem;
  color: var(--navy);
  font-size: 1.2rem;
  font-weight: 850;
}
.brand-text { font-weight: 760; letter-spacing: .04em; }
.brand-text span { font-weight: 470; margin-left: .33rem; letter-spacing: 0; color: #c4d8ea; }
.user-controls { display: flex; align-items: center; gap: .8rem; }
.header-name { color: #d5e5f4; font-size: .88rem; max-width: 18rem; overflow-wrap: anywhere; }
.header-action { background: none; border: 0; color: #fff; font-size: .88rem; padding: .4rem .15rem; text-decoration: none; }
.header-action:hover:not(:disabled) { background: none; text-decoration: underline; text-underline-offset: .22rem; }

#main { flex: 1; width: min(100%, 76rem); margin: 0 auto; padding: 0 var(--space) 3.5rem; }
.site-footer { text-align: center; padding: 1rem var(--space) 1.25rem; color: var(--muted); font-size: .81rem; }
.loading-shell { padding-top: 4rem; max-width: 32rem; margin: 0 auto; }
.loading-shell button { margin-top: .75rem; }
.auth-layout {
  display: grid;
  grid-template-columns: 1.1fr minmax(0, .9fr);
  gap: clamp(1rem, 6vw, 5rem);
  max-width: 59rem;
  padding-top: clamp(2rem, 9vw, 7rem);
  margin: 0 auto;
  align-items: start;
}
.auth-intro { padding: clamp(.5rem, 3vw, 2rem) 0; }
.auth-intro .kicker { color: var(--blue); font-size: .85rem; font-weight: 700; margin-bottom: .9rem; }
.auth-intro h1 { font-size: clamp(2.5rem, 6vw, 4rem); }
.private-label {
  align-items: center;
  background: #e8f1fa;
  border: 1px solid #d8e7f6;
  color: #284b6e;
  display: inline-flex;
  font-size: .81rem;
  gap: .4rem;
  margin-top: 1.4rem;
  padding: .27rem .65rem;
  border-radius: 1rem;
}
.private-label span { width: .42rem; height: .42rem; border-radius: 50%; background: #226fae; }
.panel { padding: clamp(1rem, 3vw, 1.65rem); background: var(--surface); border: 1px solid var(--border); border-radius: .85rem; }
.auth-panel { box-shadow: 0 1rem 2.5rem #142a4010; }
.form-intro { margin: .45rem 0 1.1rem; color: var(--muted); font-size: .9rem; }
.form-hint { color: var(--muted); font-size: .85rem; margin-top: .75rem; text-align: center; }
label { display: block; font-weight: 650; font-size: .9rem; margin: .8rem 0 .36rem; }
input:not([type=file]), textarea, select {
  display: block;
  width: 100%;
  min-width: 0;
  padding: .58rem .68rem;
  color: var(--ink);
  background: #fff;
  border: 1px solid #bdcddb;
  border-radius: .42rem;
}
textarea { resize: vertical; min-height: 8rem; }
textarea::placeholder { color: #65788b; }
.wide { width: 100%; }
button, .button-link {
  padding: .54rem .85rem;
  border: 1px solid #b8cbdd;
  border-radius: .42rem;
  background: var(--surface);
  color: var(--blue-dark);
  font-size: .88rem;
  font-weight: 680;
  text-decoration: none;
}
button:hover:not(:disabled), .button-link:hover { background: var(--tint); }
.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.primary:hover:not(:disabled) { background: var(--blue-dark); border-color: var(--blue-dark); }
.auth-panel .primary { margin-top: 1rem; }
.text-button { background: none; border: 1px solid transparent; padding: .34rem .1rem; text-decoration: underline; text-underline-offset: .16rem; }
.auth-panel .text-button { display: block; margin: .6rem auto 0; }
.danger-button { color: var(--danger); }
.status { margin: .6rem 0; padding: .5rem .65rem; color: #284b6e; background: #eaf3fb; border-radius: .4rem; overflow-wrap: anywhere; }
.status[data-kind="error"] { background: #fff0ef; color: var(--danger); }
.status[data-kind="success"] { background: #e7f5ed; color: #205738; }

.workspace { padding-top: clamp(1.65rem, 5vw, 3rem); }
.workspace-heading { display: flex; align-items: end; justify-content: space-between; flex-wrap: wrap; gap: 1rem; padding-bottom: 1.3rem; border-bottom: 1px solid var(--border); }
.workspace-heading nav { display: flex; flex-wrap: wrap; gap: .3rem; }
.workspace-heading nav button { background: transparent; border-color: transparent; }
.workspace-heading nav button:hover { background: #e7f1fb; }
.workspace-heading nav [aria-current="page"] { color: var(--blue-dark); background: #e5eff9; }
#view { padding-top: 1.35rem; }
.report-layout { display: grid; grid-template-columns: minmax(0, .94fr) minmax(0, 1.16fr); gap: clamp(1rem, 3vw, 1.65rem); align-items: start; }
.section-heading { margin-bottom: .95rem; }
.section-heading p { margin-top: .35rem; color: var(--muted); font-size: .9rem; }
.week-control { display: grid; grid-template-columns: minmax(6.5rem, 10rem) 1fr; gap: .65rem; align-items: center; }
.week-control small { font-size: .82rem; }
.editor-footer, .report-card-header, .dialog-actions, .detail-row, .inline-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .65rem;
}
.editor-footer { justify-content: space-between; margin-top: .95rem; }
.editor-footer .inline-actions { gap: .45rem; }
.char-count { display: block; margin-top: .28rem; text-align: right; }
.char-count[data-kind="error"] { color: var(--danger); }
.attachment-editor { margin-top: .9rem; padding-top: .85rem; border-top: 1px solid var(--border); }
.attachment-editor label { margin-top: 0; }
.file-input { display: block; margin: .4rem 0; max-width: 100%; color: var(--muted); font-size: .84rem; }
.file-input::file-selector-button { border: 1px solid #bfccda; color: var(--blue-dark); background: var(--tint); border-radius: .4rem; padding: .35rem .5rem; margin-inline-end: .5rem; cursor: pointer; }
.attachment-list, .member-list { list-style: none; padding: 0; }
.attachment-list { margin-top: .55rem; }
.attachment-list li { display: flex; align-items: center; justify-content: space-between; gap: .6rem; border-top: 1px solid var(--border); padding: .3rem 0; font-size: .83rem; }
.attachment-list li span { overflow-wrap: anywhere; }
.attachment-list button { flex-shrink: 0; }
.report-list { list-style: none; padding: 0; display: grid; gap: .8rem; }
.report-card { padding: 1rem 1.15rem; overflow-wrap: anywhere; }
.report-card-header { justify-content: space-between; align-items: start; }
.report-card-header p { color: var(--muted); font-size: .8rem; margin-top: .2rem; }
.report-body { color: #20364c; margin-top: .8rem; white-space: pre-wrap; line-height: 1.7; }
.media-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 10rem), 1fr)); gap: .6rem; margin-top: .8rem; }
.attachment-preview { border: 1px solid var(--border); border-radius: .45rem; overflow: hidden; background: #f4f7fa; }
.attachment-preview img, .attachment-preview video { display: block; width: 100%; background: #eef2f6; max-height: 20rem; object-fit: contain; }
.attachment-preview a { display: block; }
.attachment-preview figcaption { padding: .37rem .53rem; color: var(--muted); font-size: .79rem; }
.comments { margin-top: .95rem; border-top: 1px solid var(--border); padding-top: .8rem; }
.comments h3, .comments h4 { font-size: .92rem; margin: 0; }
.comments ol { list-style: none; padding: 0; }
.comments li { background: var(--tint); border-inline-start: .2rem solid #4a81b3; border-radius: .32rem; margin-top: .56rem; padding: .5rem .65rem; }
.comments li p:last-of-type { white-space: pre-wrap; color: #20364c; }
.comment-meta { color: var(--muted); font-size: .8rem; margin-bottom: .26rem; }
.comments .subtle { margin-top: .35rem; font-size: .84rem; }
.comment-form textarea { min-height: 4.1rem; }
.comment-form .editor-footer { margin-top: .6rem; }
.empty { color: var(--muted); padding: 1.5rem 1rem; text-align: center; border: 1px dashed #b7c9da; border-radius: .65rem; }
.filter-panel { display: flex; flex-wrap: wrap; gap: .9rem; align-items: flex-end; margin-bottom: 1rem; }
.filter-panel label { margin-top: 0; }
.filter-panel > div { width: min(100%, 19rem); }
.wide-list { max-width: 52rem; }
.admin-layout { display: grid; grid-template-columns: minmax(0, .88fr) minmax(0, 1.12fr); gap: 1rem; align-items: start; }
.admin-layout > div > section + section { margin-top: 1rem; }
.detail-row { border-top: 1px solid var(--border); padding: .7rem 0; justify-content: space-between; overflow-wrap: anywhere; }
.detail-row:first-child { border-top: 0; }
.detail-row p { font-size: .87rem; }
.detail-row button { flex-shrink: 0; }
.invite-output { margin-top: .75rem; padding: .75rem; background: var(--tint); border-radius: .45rem; }
.invite-output label { margin-top: 0; }
.invite-output button, .account-panel form button { margin-top: .7rem; }
.account-panel { max-width: 34rem; }
.account-meta { margin: .65rem 0 1rem; }
.account-meta p { overflow-wrap: anywhere; }

@media (max-width: 850px) {
  .report-layout, .admin-layout { grid-template-columns: 1fr; }
}
@media (max-width: 650px) {
  .auth-layout { grid-template-columns: 1fr; padding-top: 1.35rem; }
  .auth-intro { padding: .6rem 0; }
  .workspace-heading { align-items: start; flex-direction: column; }
}
@media (max-width: 420px) {
  .header-name { display: none; }
  .week-control { grid-template-columns: minmax(0, 1fr); gap: .3rem; }
  .report-card { padding: .85rem; }
}
@media (prefers-reduced-motion: no-preference) {
  :root { scroll-behavior: smooth; }
}
