:root {
  --ink: #142137;
  --muted: #516077;
  --navy: #103671;
  --primary-hover: #0a2858;
  --surface: #fff;
  --background: #f3f5f8;
  --line: #d8dfe9;
  --soft-blue: #edf3fb;
  --green: #16614d;
  --warning: #70501c;
  --warn-bg: #fff9e9;
  --red: #9d2931;
  font: 15px/1.55 Inter, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--background);
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }
.shell { max-width: 1280px; padding-inline: 2rem; margin-inline: auto; }
.topbar { background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar-inner { display: flex; justify-content: space-between; align-items: center; min-height: 3.75rem; gap: 1rem; }
.brand { display: flex; gap: .75rem; align-items: center; font-size: 1rem; font-weight: 700; }
.brand-mark { width: 1.25rem; height: 1.25rem; border: 2px solid var(--navy); border-radius: 4px; background: linear-gradient(transparent 28%, var(--navy) 28% 40%, transparent 40% 60%, var(--navy) 60% 72%, transparent 72%); }
.local { color: var(--muted); font-size: .8125rem; white-space: nowrap; }
.local span { display: inline-block; width: .4375rem; height: .4375rem; border-radius: 50%; background: var(--green); vertical-align: 1px; }
main { padding-block: 2.5rem 3rem; }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(1.8rem, 4vw, 2.5rem); line-height: 1.2; font-weight: 750; }
h2 { font-size: 1.125rem; line-height: 1.4; }
p { color: var(--muted); }
.heading { display: flex; justify-content: space-between; align-items: center; gap: 1.25rem; margin-bottom: 1.5rem; }
.heading p { margin-top: .5rem; }
.week-control { display: grid; grid-template-columns: auto auto; align-items: center; gap: .25rem .75rem; }
.week-control label { font-size: .875rem; font-weight: 650; }
#week-range { grid-column: 2; color: var(--muted); font-size: .8rem; }
.ingest, .export { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 1rem; padding: 1.25rem 1.5rem; }
.ingest { border: 1px solid #c9d8ec; background: var(--soft-blue); border-radius: .75rem; }
.ingest p, .export p { margin-top: .25rem; font-size: .875rem; }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
button, input, select, a.download { font: inherit; }
button, a.download {
  padding: .55rem .875rem;
  border: 1px solid transparent;
  border-radius: .375rem;
  font-size: .875rem;
  font-weight: 650;
  line-height: 1.5;
  cursor: pointer;
  white-space: nowrap;
}
button:disabled { opacity: .48; cursor: default; }
.primary { background: var(--navy); color: white; }
.primary:not(:disabled):hover { background: var(--primary-hover); }
.secondary, a.download { background: var(--surface); border-color: var(--line); color: var(--navy); text-decoration: none; }
.secondary:not(:disabled):hover, a.download:hover { background: var(--soft-blue); }
.small { padding: .35rem .6rem; }
.danger { color: var(--red); background: white; border-color: var(--line); }
.danger:hover { background: #fff1f1; }
:focus-visible { outline: 2px solid #2461b4; outline-offset: 2px; }
.status:not(:empty) { padding-block: .625rem; font-size: .875rem; }
.status.error, #export-error { color: var(--red); }
.empty { text-align: center; background: var(--surface); border: 1px dashed #c6d0df; padding: 3rem 1rem; border-radius: .75rem; margin-block: 1.25rem; }
.empty p { margin-top: .375rem; }
.group-nav { display: flex; gap: .5rem; overflow-x: auto; padding: .25rem; margin: 1rem -.25rem .75rem; }
.group-tab { display: flex; align-items: center; gap: .5rem; border-color: var(--line); color: var(--ink); background: var(--surface); }
.group-tab[aria-current="true"] { background: var(--navy); color: white; border-color: var(--navy); }
.group-tab span { font-size: .75rem; font-weight: 500; color: var(--muted); }
.group-tab[aria-current="true"] span { color: #e6efff; }
.work-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.8fr); gap: 1rem; align-items: start; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: .75rem; overflow: hidden; }
.panel-head { padding: 1rem 1.125rem; border-bottom: 1px solid var(--line); display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .625rem; }
.panel-head p { font-size: .8rem; margin-top: .125rem; }
#photos { padding: 1rem; }
.photo-tabs { display: flex; gap: .5rem; margin-bottom: .625rem; flex-wrap: wrap; }
.photo-tabs [aria-current="true"] { border-color: var(--navy); }
.photo-link { display: block; background: #e9edf2; border-radius: .375rem; line-height: 0; text-align: center; }
.photo-link img { width: 100%; max-height: 32rem; object-fit: contain; }
.photo-caption { margin-top: .5rem; font-size: .8rem; overflow-wrap: anywhere; }
details { margin-top: .75rem; font-size: .8125rem; color: var(--muted); overflow-wrap: anywhere; }
summary { cursor: pointer; color: var(--navy); }
#group-form { padding: 1.125rem; }
.fields { display: flex; flex-wrap: wrap; align-items: end; gap: .75rem; margin-bottom: 1rem; }
.fields label { display: grid; gap: .25rem; font-size: .8125rem; font-weight: 650; }
input, select { width: 100%; min-width: 0; border: 1px solid #b8c5d6; border-radius: .3rem; color: var(--ink); background: var(--surface); min-height: 2.25rem; padding: .3125rem .5rem; }
input[type="date"] { width: auto; }
input[data-ocr], select[data-ocr] { background: var(--warn-bg); border-color: #cda65a; }
input[data-estimated] { border-style: dashed; border-color: var(--warning); }
input[aria-invalid="true"] { border-color: var(--red); }
.sheet-scroll { overflow-x: auto; padding: .125rem; }
.editor table { border-collapse: collapse; width: 100%; table-layout: fixed; min-width: 31rem; font-size: .8125rem; }
th { text-align: left; background: #f1f4f8; font-weight: 650; }
th, td { border-bottom: 1px solid var(--line); padding: .4375rem .375rem; vertical-align: middle; }
th:first-child { width: 17%; }
th:last-child { width: 19%; }
td input { font-variant-numeric: tabular-nums; }
.unit select { margin-top: .3125rem; }
.note { margin-block: .75rem; font-size: .8125rem; }
.decimal-review { margin-bottom: .5rem; font-size: .8125rem; color: var(--warning); }
.review { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .75rem; padding-top: .5rem; }
.review-status { flex: 1; font-size: .8125rem; color: var(--warning); min-width: 12rem; }
.review-status.error { color: var(--red); }
.review-status.confirmed { color: var(--green); }
.export { margin-top: 1.25rem; }
.report-fields {
  flex: 1 0 100%;
  display: grid;
  grid-template-columns: minmax(0, .8fr) minmax(0, 1fr) minmax(0, 1.65fr);
  gap: .75rem;
}
.report-fields label {
  display: grid;
  gap: .25rem;
  font-size: .8125rem;
  font-weight: 650;
}
.report-fields input { width: 100%; }
@media (max-width: 560px) {
  .report-fields { grid-template-columns: 1fr 1fr; }
  .report-fields label:last-child { grid-column: 1 / -1; }
}
dialog { width: min(90vw, 30rem); border: 1px solid var(--line); border-radius: .75rem; padding: 1.25rem; }
dialog .actions { margin-top: 1rem; }
dialog::backdrop { background: #14213766; }
@media (max-width: 860px) {
  .shell { padding-inline: 1rem; }
  .work-grid { grid-template-columns: minmax(0, 1fr); }
  .photo-link img { max-height: 24rem; }
}
@media (max-width: 560px) {
  main { padding-top: 1.5rem; }
  .heading { align-items: start; flex-direction: column; }
  .ingest, .export, .panel-head, #group-form { padding: .875rem; }
  .heading p { font-size: .875rem; }
}
