:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  background: #f4f6f5;
  color: #17222b;
}

* { box-sizing: border-box; }

body { margin: 0; min-width: 320px; background: #f4f6f5; }

button, input, select { font: inherit; }

.site-header { background: #0d3b45; color: #f7fbfa; border-bottom: 4px solid #e4b54b; }

.header-inner, .page-shell { width: min(1120px, calc(100% - 32px)); margin: 0 auto; }

.header-inner { min-height: 128px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }

.eyebrow { margin: 0 0 6px; color: #4f6870; font-size: 13px; line-height: 1.25; }
.site-header .eyebrow { color: #b7d3d0; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: 30px; font-weight: 720; line-height: 1.15; letter-spacing: 0; }
h2 { margin-bottom: 0; font-size: 21px; line-height: 1.25; letter-spacing: 0; }
h3 { margin-bottom: 6px; font-size: 16px; line-height: 1.35; letter-spacing: 0; }

.refresh-button { min-height: 42px; padding: 0 16px; border: 1px solid #b7d3d0; border-radius: 4px; background: transparent; color: #fff; cursor: pointer; white-space: nowrap; }
.refresh-button:hover, .refresh-button:focus-visible { background: #1a505b; outline: 2px solid #e4b54b; outline-offset: 2px; }
.refresh-button:disabled { opacity: .65; cursor: wait; }

.page-shell { padding: 22px 0 46px; }
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-shell { width: min(100%, 400px); }
.login-panel { padding: 32px; border: 1px solid #d6dedb; border-top: 4px solid #e4b54b; border-radius: 6px; background: #fff; box-shadow: 0 12px 32px rgba(13, 59, 69, .09); }
.login-panel .eyebrow { color: #4f6870; }
.login-panel h1 { color: #0d3b45; margin-bottom: 28px; }
.login-form { display: grid; gap: 10px; }
.login-form label { color: #385059; font-size: 14px; }
.login-form input { width: 100%; min-height: 44px; border: 1px solid #b8c7c3; border-radius: 4px; background: #fff; color: #17222b; padding: 0 12px; }
.login-form input:focus { outline: 2px solid #27806a; outline-offset: 1px; border-color: #27806a; }
.login-form button { min-height: 44px; border: 1px solid #0d3b45; border-radius: 4px; background: #0d3b45; color: #fff; cursor: pointer; }
.login-form button:hover, .login-form button:focus-visible { background: #1a505b; outline: 2px solid #e4b54b; outline-offset: 2px; }
.login-form button:disabled { opacity: .65; cursor: wait; }
.login-error { margin: 2px 0 0; color: #b53b42; font-size: 14px; }
.status-row { min-height: 22px; display: flex; align-items: center; gap: 8px; margin-bottom: 18px; color: #4f6870; font-size: 14px; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: #cc7f35; flex: 0 0 auto; }
.status-dot.ready { background: #27806a; }
.status-dot.error { background: #b53b42; }

.statistics { margin-bottom: 28px; }
.period-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.period-stat { min-height: 190px; padding: 16px; border: 1px solid #d6dedb; border-radius: 6px; background: #fff; }
.period-stat-topline { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.period-stat-topline h3 { color: #0d3b45; margin-bottom: 0; }
.stat-range { color: #4f6870; font-size: 13px; white-space: nowrap; }
.stat-values { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 18px 0; }
.stat-values div { min-width: 0; }
.stat-values dt { color: #4f6870; font-size: 13px; }
.stat-values dd { margin: 4px 0 0; color: #0d3b45; font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; }
.school-stat { display: grid; grid-template-columns: 1fr auto auto; align-items: baseline; gap: 8px; border-top: 1px solid #d6dedb; padding-top: 12px; color: #385059; font-size: 13px; }
.school-stat strong { color: #27806a; font-size: 20px; font-variant-numeric: tabular-nums; }
.school-stat span:last-child { color: #4f6870; }
.school-dates { margin: 10px 0 0; color: #4f6870; font-size: 12px; line-height: 1.5; }

.point-stat-section { margin-top: 0; }
.point-stat-table-wrap { overflow-x: auto; border: 1px solid #d6dedb; border-radius: 6px; background: #fff; }
.point-stat-table { width: 100%; min-width: 700px; border-collapse: collapse; table-layout: fixed; }
.point-stat-table th, .point-stat-table td { padding: 12px 14px; border-bottom: 1px solid #dfe6e3; text-align: left; vertical-align: middle; }
.point-stat-table thead th { background: #eaf0ee; color: #385059; font-size: 13px; font-weight: 650; }
.point-stat-table thead th:first-child, .point-stat-table tbody th { width: 46%; }
.point-stat-table tbody tr:last-child th, .point-stat-table tbody tr:last-child td { border-bottom: 0; }
.point-stat-table tbody tr:hover { background: #f7faf8; }
.point-stat-table td { color: #0d3b45; font-size: 14px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.point-stat-name, .point-stat-group { display: block; overflow-wrap: anywhere; }
.point-stat-name { color: #17222b; font-size: 14px; font-weight: 650; line-height: 1.4; }
.point-stat-group { margin-top: 3px; color: #4f6870; font-size: 12px; font-weight: 400; line-height: 1.35; }

.controls { display: grid; grid-template-columns: 150px 150px 190px minmax(220px, 1fr); gap: 12px; padding: 16px; border: 1px solid #d6dedb; border-radius: 6px; background: #eaf0ee; margin-bottom: 28px; }
.control-field { min-width: 0; }
.control-field label { display: block; margin-bottom: 6px; color: #385059; font-size: 13px; }
.control-field input, .control-field select { width: 100%; min-height: 40px; border: 1px solid #b8c7c3; border-radius: 4px; background: #fff; color: #17222b; padding: 0 10px; }
.control-field input:focus, .control-field select:focus { outline: 2px solid #27806a; outline-offset: 1px; border-color: #27806a; }

.section-block { margin-top: 28px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
.record-count { color: #4f6870; font-size: 14px; white-space: nowrap; }
.record-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.record-card { min-height: 202px; padding: 16px; border: 1px solid #d6dedb; border-radius: 6px; background: #fff; overflow-wrap: anywhere; }
.record-topline { display: flex; align-items: center; justify-content: space-between; gap: 10px; color: #4f6870; font-size: 13px; }
.record-method { color: #27806a; }
.record-point { color: #0d3b45; font-weight: 650; line-height: 1.45; margin-bottom: 8px; }
.record-location { color: #53636a; font-size: 13px; line-height: 1.45; margin-bottom: 12px; }
.record-photos { display: flex; flex-wrap: wrap; gap: 6px; }
.record-photos a { color: #176a93; font-size: 13px; text-decoration: none; border-bottom: 1px solid currentColor; }
.record-photos a:hover { color: #b53b42; }
.empty-state { margin: 0; padding: 26px 16px; border: 1px dashed #b8c7c3; border-radius: 6px; color: #53636a; text-align: center; background: #fff; }

.point-section { padding-top: 4px; }
.point-groups { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.point-group { border-left: 4px solid #e4b54b; padding: 14px 14px 12px; background: #fff; border-top: 1px solid #d6dedb; border-right: 1px solid #d6dedb; border-bottom: 1px solid #d6dedb; border-radius: 0 6px 6px 0; }
.point-group h3 { color: #0d3b45; }
.point-group ul { margin: 0; padding-left: 18px; color: #53636a; font-size: 14px; line-height: 1.65; }

@media (max-width: 820px) {
  .period-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .controls { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .control-search { grid-column: 1 / -1; }
  .record-list, .point-groups { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 560px) {
  .header-inner, .page-shell { width: min(100% - 24px, 1120px); }
  .header-inner { min-height: 112px; align-items: flex-start; padding: 20px 0; flex-direction: column; justify-content: center; }
  h1 { font-size: 26px; }
  .refresh-button { width: 100%; }
  .period-stats, .controls, .record-list, .point-groups { grid-template-columns: 1fr; }
  .control-search { grid-column: auto; }
  .section-heading { align-items: start; }
  .login-page { padding: 16px; }
  .login-panel { padding: 24px; }
}
