:root {
  color-scheme: light;
  --ink: #152b3b;
  --muted: #718394;
  --line: #e7edf0;
  --paper: #fff;
  --teal: #087f83;
  --aqua: #25bad1;
  --navy: #10283b;
  --red: #d74b56;
  --amber: #d68a2c;
  font-family: "Sarabun", "Noto Sans Thai", system-ui, sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

* { box-sizing: border-box; }

body {
  min-width: 320px;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(ellipse at 4% 13%, rgba(53, 180, 184, .085), transparent 28rem),
    radial-gradient(ellipse at 96% 43%, rgba(86, 176, 216, .08), transparent 34rem),
    #f4f7f6;
}

button, a { font: inherit; }
a { color: inherit; }
.skip-link { position: fixed; z-index: 9; top: 8px; left: 8px; padding: 10px 14px; transform: translateY(-150%); border-radius: 10px; background: #fff; color: var(--ink); }
.skip-link:focus { transform: translateY(0); }

.site-header,
.dashboard-shell { width: min(1180px, calc(100% - 48px)); margin-inline: auto; }
.site-header { display: flex; align-items: center; justify-content: space-between; min-height: 86px; }
.school-brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; }
.school-brand img { display: block; width: 48px; height: 48px; padding: 3px; border: 1px solid #e9eff0; border-radius: 50%; background: white; object-fit: contain; box-shadow: 0 4px 12px rgba(16, 40, 59, .09); }
.school-brand strong, .school-brand small { display: block; }
.school-brand strong { font-size: 15px; font-weight: 800; letter-spacing: -.15px; }
.school-brand small { margin-top: 1px; color: var(--muted); font-size: 12px; font-weight: 500; }
.live-pill { display: inline-flex; align-items: center; gap: 9px; padding: 9px 14px; border: 1px solid #dce8e8; border-radius: 999px; background: rgba(255, 255, 255, .7); color: #44616b; font-size: 12px; font-weight: 700; }
.live-dot { width: 8px; height: 8px; flex: 0 0 8px; border-radius: 50%; background: #28a887; box-shadow: 0 0 0 4px rgba(40, 168, 135, .12); }

.hero { position: relative; isolation: isolate; display: flex; min-height: 348px; overflow: hidden; align-items: center; padding: 48px 58px; border: 1px solid rgba(10, 36, 55, .16); border-radius: 27px; background: linear-gradient(112deg, #10283b 0%, #12384a 58%, #087779 100%); box-shadow: 0 22px 54px rgba(17, 54, 68, .14); color: #fff; }
.hero-copy { position: relative; z-index: 2; width: min(62%, 600px); }
.eyebrow { display: flex; align-items: center; gap: 10px; margin: 0 0 16px; color: #a8dfda; font-size: 11px; font-weight: 800; letter-spacing: 1.45px; }
.eyebrow-line { width: 22px; height: 2px; border-radius: 3px; background: #41c7b3; }
.hero h1 { margin: 0; font-size: clamp(36px, 5vw, 56px); font-weight: 800; letter-spacing: -1.6px; line-height: 1.15; }
.hero h1 span { color: #a9e2da; }
.hero-description { max-width: 460px; margin: 16px 0 22px; color: rgba(241, 249, 249, .78); font-size: 15px; line-height: 1.8; }
.hero-meta { display: inline-flex; align-items: center; gap: 8px; color: #cae2e2; font-size: 12px; font-weight: 600; }
.hero-meta-icon { display: inline-grid; width: 20px; height: 20px; place-items: center; border: 1px solid rgba(198, 238, 233, .3); border-radius: 50%; color: #95ded2; font-size: 14px; }
.hero-art { position: absolute; z-index: 0; inset: 0 0 0 auto; width: 53%; color: #7eddd1; }
.hero-orbit { position: absolute; top: 50%; left: 57%; border: 1px solid rgba(171, 236, 226, .15); border-radius: 50%; transform: translate(-50%, -50%); }
.hero-orbit-outer { width: 430px; height: 430px; }
.hero-orbit-inner { width: 330px; height: 330px; border-color: rgba(171, 236, 226, .2); }
.hero-watermark { position: absolute; top: 50%; left: 57%; width: 235px; padding: 30px 18px; transform: translate(-50%, -58%); border: 1px solid rgba(205, 246, 239, .16); border-radius: 22px; background: linear-gradient(145deg, rgba(255,255,255,.105), rgba(255,255,255,.025)); color: rgba(221, 252, 247, .82); text-align: center; font-size: 27px; font-weight: 800; letter-spacing: 5px; line-height: 1.2; box-shadow: 0 20px 55px rgba(6, 29, 43, .18); backdrop-filter: blur(8px); }
.hero-watermark span { color: rgba(180, 233, 226, .8); font-size: 9px; letter-spacing: 2.4px; }
.hero-waves { position: absolute; right: -5px; bottom: -1px; width: 104%; height: 76%; }
.hero-water-card { position: absolute; z-index: 1; right: 38px; bottom: 32px; display: flex; align-items: center; gap: 11px; padding: 12px 14px; border: 1px solid rgba(230, 255, 251, .2); border-radius: 14px; background: rgba(9, 36, 49, .55); box-shadow: 0 9px 28px rgba(5, 28, 41, .12); backdrop-filter: blur(12px); }
.hero-water-icon { display: grid; width: 34px; height: 34px; place-items: center; border-radius: 10px; background: rgba(106, 221, 204, .15); color: #8ce3d6; font-size: 24px; font-weight: 500; }
.hero-water-copy small, .hero-water-copy strong { display: block; white-space: nowrap; }
.hero-water-copy small { color: rgba(233, 249, 247, .68); font-size: 10px; }
.hero-water-copy strong { margin-top: 2px; color: #fff; font-size: 12px; font-weight: 700; }
.hero-water-arrow { margin-left: 5px; color: #9ae6db; }

.priority-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin: 20px 0 24px; }
.priority-card { position: relative; display: flex; min-height: 118px; align-items: center; gap: 15px; overflow: hidden; padding: 20px 22px; border: 1px solid rgba(17, 46, 61, .07); border-radius: 18px; background: #fff; box-shadow: 0 8px 24px rgba(34, 60, 70, .045); }
.priority-icon { display: grid; width: 44px; height: 44px; flex: 0 0 44px; place-items: center; border-radius: 14px; font-size: 22px; font-weight: 800; }
.priority-danger .priority-icon { background: #fff0ef; color: var(--red); }
.priority-caution .priority-icon { background: #fff6e8; color: var(--amber); }
.priority-route .priority-icon { background: #eaf8f6; color: var(--teal); font-size: 27px; }
.priority-card p { margin: 0 0 3px; color: #526777; font-size: 12px; font-weight: 700; }
.priority-card strong { display: inline-block; margin-right: 6px; color: #173145; font-size: 32px; font-weight: 800; letter-spacing: -1px; line-height: 1.15; font-variant-numeric: tabular-nums; }
.priority-card small { color: #8a9aa5; font-size: 11px; font-weight: 600; }
.priority-corner { position: absolute; top: 14px; right: 17px; color: #a8b5bc; font-size: 15px; }

.chart-grid { display: grid; grid-template-columns: minmax(0, .92fr) minmax(0, 1.08fr); gap: 18px; align-items: stretch; }
.panel { min-width: 0; padding: 25px 26px 21px; border: 1px solid rgba(20, 57, 72, .075); border-radius: 20px; background: rgba(255, 255, 255, .95); box-shadow: 0 10px 28px rgba(31, 57, 67, .045); }
.travel-panel { grid-row: span 2; }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.panel-kicker { margin: 0 0 4px; color: #49a39e; font-size: 9px; font-weight: 800; letter-spacing: 1.25px; }
.panel-heading h2 { margin: 0; color: #1c3548; font-size: 20px; font-weight: 800; letter-spacing: -.25px; line-height: 1.35; }
.panel-subtitle { margin: 5px 0 0; color: var(--muted); font-size: 11px; line-height: 1.6; }
.panel-index { display: grid; width: 31px; height: 31px; flex: 0 0 31px; place-items: center; border: 1px solid #e4eeec; border-radius: 10px; color: #7fa29f; font-size: 10px; font-weight: 800; }

.travel-content { display: grid; grid-template-columns: minmax(155px, .9fr) minmax(150px, 1.1fr); gap: 14px; align-items: center; margin: 30px 0 16px; }
.donut-wrap { display: grid; min-height: 220px; place-items: center; }
.donut { position: relative; display: grid; width: min(100%, 208px); aspect-ratio: 1; place-items: center; border-radius: 50%; background: conic-gradient(#087f83 0deg 1deg, #25bad1 1deg 2deg, #f1bf59 2deg 3deg, #db5961 3deg 4deg, #d8e3e7 4deg 360deg); transition: background .25s ease; }
.donut::before { position: absolute; inset: 15%; border-radius: 50%; background: #fff; box-shadow: inset 0 0 0 1px #edf2f2; content: ""; }
.donut-center { position: relative; display: flex; align-items: center; flex-direction: column; color: #82949e; }
.donut-center span { font-size: 11px; }
.donut-center strong { margin-top: 1px; color: #234355; font-size: 15px; font-weight: 800; }
.travel-legend { display: grid; gap: 14px; margin: 0; padding: 0; list-style: none; }
.travel-legend li { display: grid; grid-template-columns: 9px minmax(0, 1fr); gap: 8px; align-items: start; }
.legend-dot { width: 8px; height: 8px; margin-top: 5px; border-radius: 50%; }
.legend-copy { display: flex; justify-content: space-between; gap: 8px; color: #536977; font-size: 11px; line-height: 1.5; }
.legend-label { min-width: 0; }
.legend-value { flex: 0 0 auto; color: #203b4e; font-weight: 800; font-variant-numeric: tabular-nums; }
.chart-note { display: flex; gap: 8px; margin: 18px 0 0; padding: 11px 12px; border-radius: 11px; background: #f2f8f7; color: #607b7c; font-size: 10px; line-height: 1.55; }
.note-mark { display: grid; width: 15px; height: 15px; flex: 0 0 15px; place-items: center; border: 1px solid #83b6b0; border-radius: 50%; color: #4c9189; font-size: 10px; font-weight: 800; }

.bar-list { display: grid; gap: 16px; margin-top: 25px; }
.bar-row { display: grid; grid-template-columns: minmax(90px, 1fr) minmax(100px, 1.2fr) 27px; gap: 10px; align-items: center; }
.bar-label { overflow: hidden; color: #526777; font-size: 11px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { height: 10px; overflow: hidden; border-radius: 999px; background: #edf2f3; }
.bar-fill { display: block; height: 100%; min-width: 3px; border-radius: inherit; background: linear-gradient(90deg, #2fc0c0, #087f83); transition: width .3s ease; }
.bar-row[data-severity="high"] .bar-fill { background: linear-gradient(90deg, #f29b68, #dc5d5b); }
.bar-row[data-severity="medium"] .bar-fill { background: linear-gradient(90deg, #f4cf76, #e69c43); }
.bar-row[data-severity="low"] .bar-fill { background: linear-gradient(90deg, #85d9ce, #2da994); }
.bar-row[data-severity="safe"] .bar-fill { background: linear-gradient(90deg, #afc8cc, #7899a2); }
.bar-value { color: #254154; font-size: 12px; font-weight: 800; text-align: right; font-variant-numeric: tabular-nums; }
.scale-caption { display: flex; justify-content: space-between; margin-top: 17px; padding-top: 11px; border-top: 1px solid #edf1f2; color: #91a0a9; font-size: 10px; }
.route-tip { display: flex; align-items: flex-start; gap: 11px; margin-top: 23px; padding: 14px 15px; border: 1px solid #dbeeea; border-radius: 13px; background: linear-gradient(110deg, #f0faf8, #f7fbfa); }
.route-tip-icon { display: grid; width: 29px; height: 29px; flex: 0 0 29px; place-items: center; border-radius: 9px; background: #dff4ef; color: #278f80; font-size: 20px; }
.route-tip p { margin: 0; color: #6a8286; font-size: 10px; line-height: 1.7; }
.route-tip strong { color: #2d6b65; font-size: 11px; }

.notice-panel { display: grid; grid-template-columns: 32px 1fr auto; gap: 12px; align-items: center; padding: 18px 21px; border: 1px solid #f0e5ce; border-radius: 17px; background: linear-gradient(100deg, #fffaf0, #fffdf8); }
.notice-symbol { display: grid; width: 29px; height: 29px; place-items: center; border: 1px solid #e9c77d; border-radius: 50%; color: #b7812c; font-size: 16px; font-weight: 800; }
.notice-panel strong { color: #795c2f; font-size: 12px; }
.notice-panel p { margin: 3px 0 0; color: #897b61; font-size: 10px; line-height: 1.65; }
.notice-panel a { padding: 7px 10px; border: 1px solid #ead8b5; border-radius: 9px; color: #8b6a33; font-size: 10px; font-weight: 750; text-decoration: none; white-space: nowrap; }
.notice-panel a:hover { background: #fff3d9; }

.dashboard-footer { display: flex; min-height: 82px; align-items: center; justify-content: space-between; gap: 15px; color: #70838d; font-size: 11px; }
.dashboard-footer > p { display: flex; align-items: center; gap: 9px; margin: 0; font-weight: 700; }
.dashboard-footer > p img { padding: 2px; border: 1px solid #e6ecee; border-radius: 50%; background: #fff; object-fit: contain; }
.footer-status { display: flex; align-items: center; gap: 10px; }
.footer-status .live-dot { width: 7px; height: 7px; flex-basis: 7px; }
.footer-status button { margin-left: 5px; padding: 7px 10px; border: 1px solid #dce7e8; border-radius: 9px; background: rgba(255,255,255,.7); color: #496a71; font-size: 10px; font-weight: 750; cursor: pointer; }
.footer-status button:hover { border-color: #add3d0; background: #fff; }
.footer-status button:disabled { cursor: progress; opacity: .65; }
.error-message { position: fixed; right: 20px; bottom: 20px; z-index: 5; max-width: min(400px, calc(100vw - 40px)); padding: 12px 16px; border: 1px solid #f1d3c9; border-radius: 13px; background: #fff9f7; color: #915347; box-shadow: 0 10px 30px rgba(43, 50, 56, .12); font-size: 12px; line-height: 1.6; }
.error-message[hidden] { display: none; }

@media (max-width: 900px) {
  .site-header, .dashboard-shell { width: min(100% - 32px, 700px); }
  .hero { min-height: 335px; padding: 38px 34px; }
  .hero-copy { width: 69%; }
  .hero-art { width: 49%; opacity: .78; }
  .hero-watermark { left: 60%; width: 190px; font-size: 22px; }
  .hero-orbit { left: 60%; }
  .hero-water-card { right: 18px; bottom: 20px; }
  .priority-grid { gap: 10px; }
  .priority-card { gap: 10px; padding: 16px 14px; }
  .priority-card strong { font-size: 28px; }
  .priority-icon { width: 38px; height: 38px; flex-basis: 38px; }
  .chart-grid { grid-template-columns: 1fr; }
  .travel-panel { grid-row: auto; }
  .travel-content { grid-template-columns: minmax(180px, .9fr) minmax(200px, 1.1fr); max-width: 560px; margin-inline: auto; }
}

@media (max-width: 560px) {
  .site-header, .dashboard-shell { width: calc(100% - 24px); }
  .site-header { min-height: 72px; }
  .school-brand img { width: 43px; height: 43px; }
  .school-brand strong { font-size: 13px; }
  .school-brand small { font-size: 10px; }
  .live-pill { gap: 7px; padding: 7px 10px; font-size: 10px; }
  .hero { min-height: 415px; align-items: flex-start; padding: 31px 23px; border-radius: 22px; }
  .hero-copy { width: 100%; }
  .hero h1 { font-size: 40px; letter-spacing: -1px; }
  .hero-description { max-width: 315px; margin: 13px 0 15px; font-size: 13px; }
  .hero-meta { font-size: 10px; }
  .hero-art { inset: auto 0 0; width: 100%; height: 45%; opacity: .8; }
  .hero-orbit { top: 50%; left: 75%; }
  .hero-orbit-outer { width: 245px; height: 245px; }
  .hero-orbit-inner { width: 188px; height: 188px; }
  .hero-watermark { top: 43%; left: 75%; width: 145px; padding: 16px 10px; border-radius: 16px; font-size: 17px; letter-spacing: 3px; }
  .hero-watermark span { font-size: 7px; }
  .hero-water-card { right: 15px; bottom: 14px; gap: 8px; padding: 8px 10px; }
  .hero-water-icon { width: 29px; height: 29px; font-size: 19px; }
  .hero-water-copy small { font-size: 8px; }
  .hero-water-copy strong { font-size: 10px; }
  .hero-water-arrow { font-size: 12px; }
  .priority-grid { grid-template-columns: 1fr; gap: 9px; margin: 13px 0 16px; }
  .priority-card { min-height: 83px; gap: 13px; padding: 12px 15px; border-radius: 14px; }
  .priority-icon { width: 38px; height: 38px; flex-basis: 38px; border-radius: 12px; }
  .priority-card p { font-size: 11px; }
  .priority-card strong { font-size: 27px; }
  .panel { padding: 20px 17px 17px; border-radius: 17px; }
  .panel-heading h2 { font-size: 18px; }
  .panel-subtitle { max-width: 285px; font-size: 10px; }
  .travel-content { grid-template-columns: minmax(118px, .84fr) minmax(144px, 1.16fr); gap: 7px; margin: 20px 0 10px; }
  .donut-wrap { min-height: 170px; }
  .donut { width: min(100%, 160px); }
  .donut::before { inset: 16%; }
  .donut-center span { font-size: 9px; }
  .donut-center strong { font-size: 13px; }
  .travel-legend { gap: 10px; }
  .legend-copy { gap: 4px; font-size: 10px; }
  .bar-list { gap: 15px; margin-top: 22px; }
  .bar-row { grid-template-columns: minmax(82px, .9fr) minmax(82px, 1.2fr) 23px; gap: 7px; }
  .bar-label { font-size: 10px; }
  .bar-track { height: 9px; }
  .bar-value { font-size: 11px; }
  .notice-panel { grid-template-columns: 29px 1fr; gap: 9px; padding: 14px; }
  .notice-panel a { grid-column: 2; justify-self: start; }
  .dashboard-footer { min-height: 90px; align-items: flex-start; flex-direction: column; justify-content: center; gap: 8px; padding-block: 10px; font-size: 10px; }
  .footer-status { gap: 8px; }
  .footer-status button { margin-left: 2px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
