/* ศูนย์รวมระบบสารสนเทศ โรงเรียนสาธิตละอออุทิศ ลำปาง — v2 (Cloudflare)
   ธีมโรงเรียน: ฟ้าพาสเทล #84d4f4 + ขาว + น้ำเงินเข้ม
   สีประกอบหยิบจากภาพโรงเรียน: เหลืองอาคารปฐมวัย, เขียวชุดปฐมวัย, แดงแถบเสื้อ */

:root {
  --sky: #84d4f4;
  --sky-50: #f2fbff;
  --sky-100: #e2f5fd;
  --sky-200: #c4ebfb;
  --sky-500: #3fb0e0;
  --sky-700: #106e9c;
  --navy: #123a6b;
  --navy-2: #1d4f8a;
  --ink: #1c2b44;
  --muted: #56677f;
  --line: #d9e9f3;
  --bg: #f5fbfe;
  --surface: #ffffff;
  --surface-2: #f1f8fc;

  --sun: #f5b82e;   --sun-ink: #9a5b00;  --sun-100: #fff3d4;
  --leaf: #4cb871;  --leaf-ink: #1f7a42; --leaf-100: #e2f5e8;
  --rose: #ef6f74;  --rose-ink: #b3333a; --rose-100: #fde6e7;
  --grape: #8576e6; --grape-ink: #4f3fb5; --grape-100: #ebe8fd;
  --sky-ink: #0f6c99;

  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius: 16px;
  --radius-sm: 12px;
  --shadow-sm: 0 2px 8px rgba(18, 58, 107, .06);
  --shadow: 0 10px 30px rgba(18, 58, 107, .10);
  --shadow-lg: 0 24px 60px rgba(18, 58, 107, .18);
  --ring: 0 0 0 3px #fff, 0 0 0 6px var(--sky-500);

  --font-head: 'Mitr', 'Sarabun', system-ui, -apple-system, sans-serif;
  --font-body: 'Sarabun', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #0b1829;
  --surface: #12233a;
  --surface-2: #172c48;
  --ink: #e5eef9;
  --muted: #a5b6cc;
  --line: #24405f;
  --navy: #d6ecfb;
  --navy-2: #b5dcf6;
  --sky-50: #10263f;
  --sky-100: #143252;
  --sky-200: #1c4469;
  --sky-ink: #8fd8f7;
  --sun-ink: #ffd27a;  --sun-100: #3a2f12;
  --leaf-ink: #8fe0aa; --leaf-100: #15362a;
  --rose-ink: #ffb0b3; --rose-100: #3b1d24;
  --grape-ink: #c5bcff; --grape-100: #2a2550;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, .3);
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, .5);
  --ring: 0 0 0 3px var(--bg), 0 0 0 6px var(--sky);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html[data-lang="th"] .en { display: none !important; }
html[data-lang="en"] .th { display: none !important; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 16.5px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: inherit; }
button, input { font: inherit; color: inherit; }
h1, h2, h3 { font-family: var(--font-head); font-weight: 500; color: var(--navy); line-height: 1.25; margin: 0; }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: 10px; }

.wrap { width: min(1200px, 100% - 40px); margin-inline: auto; }
.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: 16px; top: -60px; z-index: 100;
  background: var(--navy); color: #fff; padding: 10px 16px; border-radius: 12px; text-decoration: none;
}
.skip-link:focus { top: 12px; }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
}
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 72px; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; min-width: 0; }
.brand-logo { width: 52px; height: 52px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); flex: none; }
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-text strong { font-family: var(--font-head); font-weight: 500; font-size: 17px; color: var(--navy); line-height: 1.25; }
.brand-text small { font-size: 13.5px; color: var(--muted); line-height: 1.3; }
.topbar-tools { display: flex; align-items: center; gap: 10px; flex: none; }
.clock { font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.lang-switch { display: inline-flex; padding: 4px; border-radius: 999px; background: var(--sky-100); }
.lang-switch button {
  border: 0; background: transparent; min-width: 44px; height: 36px; border-radius: 999px;
  font-family: var(--font-head); font-size: 14px; color: var(--muted); cursor: pointer;
}
.lang-switch button[aria-pressed="true"] { background: var(--surface); color: var(--navy); box-shadow: var(--shadow-sm); }
.icon-btn {
  display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--surface); color: var(--navy); cursor: pointer;
  transition: transform .15s ease, background .15s ease;
}
.icon-btn:hover { background: var(--sky-100); }
.icon-btn:active { transform: scale(.95); }

/* ---------- Hero ---------- */
.hero { position: relative; isolation: isolate; min-height: clamp(560px, 50vw, 700px); display: flex; align-items: center; overflow: hidden; }
.hero { background: linear-gradient(180deg, #d7f0fc 0%, #ecf8fe 55%, var(--bg) 100%); }
[data-theme="dark"] .hero { background: linear-gradient(180deg, #10263f 0%, var(--bg) 100%); }
.hero-art { position: absolute; inset: 0 0 0 14%; z-index: -2; }
.hero-art img { width: 100%; height: 100%; object-fit: cover; object-position: 72% 60%; }
@media (min-width: 761px) {
  .hero-art img { -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 22%); mask-image: linear-gradient(90deg, transparent 0, #000 22%); }
}
.hero::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background:
    linear-gradient(90deg, rgba(242, 251, 255, .92) 0%, rgba(242, 251, 255, .78) 30%, rgba(242, 251, 255, 0) 56%),
    linear-gradient(180deg, rgba(242, 251, 255, .25) 0%, rgba(242, 251, 255, 0) 30%);
}
[data-theme="dark"] .hero-art img { filter: brightness(.78) saturate(.9); }
[data-theme="dark"] .hero::before {
  background: linear-gradient(90deg, rgba(11, 24, 41, .94) 0%, rgba(11, 24, 41, .8) 32%, rgba(11, 24, 41, 0) 60%);
}
.hero-inner { padding: 56px 0 120px; }
.hero-copy { max-width: 560px; }
.status-pill {
  display: inline-flex; align-items: center; gap: 8px; margin: 0 0 18px;
  padding: 7px 14px 7px 12px; border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 88%, transparent); border: 1px solid var(--line);
  font-size: 14.5px; color: var(--navy); box-shadow: var(--shadow-sm);
}
.status-pill .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--leaf); box-shadow: 0 0 0 4px var(--leaf-100); animation: pulse 2.4s ease-in-out infinite; }
.status-pill.is-warn .dot { background: var(--sun); box-shadow: 0 0 0 4px var(--sun-100); }
.pill-count { padding-left: 8px; margin-left: 2px; border-left: 1px solid var(--line); color: var(--muted); }
.pill-count b { color: var(--navy); font-family: var(--font-head); font-weight: 500; }
.greeting { margin: 0 0 6px; font-family: var(--font-head); font-size: 19px; color: var(--sky-ink); min-height: 1.5em; }
.hero h1 { font-size: clamp(40px, 5.4vw, 64px); font-weight: 600; letter-spacing: -.5px; line-height: 1.12; }
.lead { margin: 16px 0 26px; font-size: 18px; color: var(--muted); max-width: 500px; }

.search-box {
  position: relative; display: flex; align-items: center; gap: 10px;
  height: 64px; padding: 0 10px 0 22px; border-radius: 999px;
  background: var(--surface); border: 2px solid transparent; box-shadow: var(--shadow-lg);
  transition: border-color .15s ease;
}
.search-box:focus-within { border-color: var(--sky-500); }
.search-icon { color: var(--sky-500); font-size: 19px; }
.search-box input { flex: 1; min-width: 0; height: 100%; border: 0; outline: none; background: transparent; font-size: 18px; }
.search-box input::placeholder { color: color-mix(in srgb, var(--muted) 80%, transparent); }
.search-box input::-webkit-search-cancel-button { display: none; }
.kbd-hint {
  font-family: var(--font-head); font-size: 13px; color: var(--muted);
  border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 8px; padding: 1px 9px; margin-right: 8px;
}
.search-box:focus-within .kbd-hint { display: none; }
.clear-btn {
  display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%;
  border: 0; background: var(--sky-100); color: var(--navy); cursor: pointer;
}

.recent { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.recent-label { font-size: 14.5px; color: var(--muted); }
.chip-row { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 6px 14px 6px 8px;
  border-radius: 999px; border: 1px solid var(--line); background: color-mix(in srgb, var(--surface) 90%, transparent);
  text-decoration: none; font-size: 15px; color: var(--navy); cursor: pointer; box-shadow: var(--shadow-sm);
  transition: transform .15s ease, border-color .15s ease;
}
.chip:hover { transform: translateY(-1px); border-color: var(--sky); }
.chip i { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; font-size: 13px; }

.hero-wave { position: absolute; left: 0; right: 0; bottom: -1px; width: 100%; height: 90px; z-index: 0; }
.hero-wave path { fill: var(--bg); }

/* ---------- Stats ---------- */
.stats {
  position: relative; z-index: 2; margin-top: -76px;
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow);
}
.stat { display: flex; align-items: center; gap: 14px; padding: 20px 22px; }
.stat + .stat { border-left: 1px solid var(--line); }
.stat b { display: block; font-family: var(--font-head); font-weight: 500; font-size: 28px; color: var(--navy); line-height: 1.15; font-variant-numeric: tabular-nums; }
.stat span:not(.stat-icon) { font-size: 14.5px; color: var(--muted); }
.stat-icon { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 14px; flex: none; font-size: 18px; }
.sky   { background: var(--sky-100);   color: var(--sky-ink); }
.sun   { background: var(--sun-100);   color: var(--sun-ink); }
.leaf  { background: var(--leaf-100);  color: var(--leaf-ink); }
.rose  { background: var(--rose-100);  color: var(--rose-ink); }
.grape { background: var(--grape-100); color: var(--grape-ink); }

/* ---------- Layout ---------- */
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 36px; align-items: start; padding: 56px 0 72px; }
.section-head { margin-bottom: 22px; }
.eyebrow { margin: 0 0 4px; font-family: var(--font-head); font-size: 14px; letter-spacing: .4px; color: var(--sky-ink); }
.section-head h2 { font-size: clamp(28px, 3.2vw, 36px); font-weight: 600; }
.section-sub { margin: 6px 0 0; color: var(--muted); }
.systems:focus { outline: none; }

/* ---------- Groups & cards ---------- */
.system-groups { display: grid; gap: 34px; }
.group-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.group-icon { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; font-size: 16px; flex: none; }
.group-head h3 { font-size: 20px; }
.group-count { font-size: 14px; color: var(--muted); }
.group-head::after { content: ""; flex: 1; height: 1px; background: var(--line); margin-left: 4px; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(255px, 1fr)); gap: 16px; }

.card {
  --c-soft: var(--sky-100); --c-ink: var(--sky-ink); --c-solid: var(--sky);
  position: relative; display: flex; flex-direction: column; gap: 10px; min-height: 196px;
  padding: 20px; border-radius: var(--radius-lg); background: var(--surface);
  border: 1px solid var(--line); box-shadow: var(--shadow-sm);
  text-decoration: none; color: inherit; cursor: pointer; overflow: hidden;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.card::after {
  content: ""; position: absolute; right: -36px; top: -36px; width: 110px; height: 110px; border-radius: 50%;
  background: var(--c-soft); opacity: .7; transition: transform .25s ease;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--c-solid); }
.card:hover::after { transform: scale(1.15); }
.card:active { transform: translateY(-1px) scale(.99); }
.card.c-sun   { --c-soft: var(--sun-100);   --c-ink: var(--sun-ink);   --c-solid: var(--sun); }
.card.c-leaf  { --c-soft: var(--leaf-100);  --c-ink: var(--leaf-ink);  --c-solid: var(--leaf); }
.card.c-grape { --c-soft: var(--grape-100); --c-ink: var(--grape-ink); --c-solid: var(--grape); }
.card-top { position: relative; z-index: 1; display: flex; align-items: flex-start; justify-content: space-between; }
.card-icon { display: grid; place-items: center; width: 54px; height: 54px; border-radius: 16px; background: var(--c-soft); color: var(--c-ink); font-size: 22px; }
.card-go { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; color: var(--c-ink); background: var(--surface); font-size: 13px; }
.card h4 { position: relative; z-index: 1; margin: 4px 0 0; font-family: var(--font-head); font-weight: 500; font-size: 18.5px; line-height: 1.3; color: var(--navy); }
.card p {
  position: relative; z-index: 1; margin: 0; font-size: 15px; color: var(--muted); line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card-foot { position: relative; z-index: 1; margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-top: 6px; }
.card-action { display: inline-flex; align-items: center; gap: 6px; font-family: var(--font-head); font-size: 15px; color: var(--c-ink); }
.card-badge { font-size: 13px; padding: 3px 10px; border-radius: 999px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.card-badge.is-lock { background: var(--sun-100); color: var(--sun-ink); border-color: transparent; }

/* ---------- Status: skeleton / empty / error ---------- */
.skeleton-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(255px, 1fr)); gap: 16px; }
.skeleton-grid span {
  height: 196px; border-radius: var(--radius-lg);
  background: linear-gradient(90deg, var(--surface-2) 0%, var(--sky-100) 50%, var(--surface-2) 100%);
  background-size: 200% 100%; animation: shimmer 1.4s linear infinite;
}
.empty-state {
  display: flex; align-items: center; gap: 28px; padding: 28px 32px;
  background: var(--surface); border: 1px dashed var(--sky-200); border-radius: var(--radius-xl);
}
.empty-state img { width: 150px; height: auto; flex: none; }
.empty-state h3 { font-size: 22px; margin-bottom: 4px; }
.empty-state p { margin: 0 0 16px; color: var(--muted); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 22px; border-radius: 999px; border: 0; cursor: pointer;
  font-family: var(--font-head); font-size: 16px; text-decoration: none; transition: transform .15s ease, filter .15s ease;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--navy-2); color: #fff; box-shadow: 0 8px 20px rgba(29, 79, 138, .25); }
[data-theme="dark"] .btn-primary { background: var(--sky); color: #0b1829; }
.btn-primary:hover { filter: brightness(1.08); }
.btn-primary:disabled { opacity: .6; cursor: progress; }
.btn-soft { background: var(--sky-100); color: var(--navy); }

/* ---------- Side panels ---------- */
.side { display: grid; gap: 20px; position: sticky; top: 92px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 22px; box-shadow: var(--shadow-sm); }
.panel h2 { font-size: 20px; }
.panel-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.panel-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--rose-100); color: var(--rose-ink); }
.news-list { list-style: none; margin: 0; padding: 0; display: grid; }
.news-item { display: flex; gap: 14px; padding: 14px 0; }
.news-item + .news-item { border-top: 1px solid var(--line); }
.news-date {
  flex: none; display: flex; flex-direction: column; align-items: center; justify-content: center;
  width: 58px; height: 62px; border-radius: 14px; background: var(--sky-100); color: var(--sky-ink); line-height: 1.1;
}
.news-date b { font-family: var(--font-head); font-weight: 500; font-size: 22px; }
.news-date small { font-size: 12.5px; }
.news-title { display: block; font-weight: 600; color: var(--ink); text-decoration: none; line-height: 1.45; }
a.news-title:hover { color: var(--sky-ink); text-decoration: underline; }
.news-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 6px; font-size: 13.5px; color: var(--muted); }
.tag { padding: 2px 10px; border-radius: 999px; font-size: 12.5px; background: var(--leaf-100); color: var(--leaf-ink); }
.tag.is-maint { background: var(--sun-100); color: var(--sun-ink); }
.news-empty { color: var(--muted); padding: 8px 0; }
.tips { background: linear-gradient(160deg, var(--sky-100), var(--surface) 70%); }
.tips h2 { margin-bottom: 10px; }
.tips ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.tips li { display: flex; gap: 12px; font-size: 15px; color: var(--muted); }
.tips li i { color: var(--sky-ink); margin-top: 5px; width: 16px; text-align: center; }

/* ---------- Footer ---------- */
.site-footer { background: var(--navy-2); color: #e9f4fc; padding: 34px 0 calc(34px + env(safe-area-inset-bottom)); }
[data-theme="dark"] .site-footer { background: #081322; }
.footer-inner { display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.footer-brand { display: flex; align-items: center; gap: 14px; }
.footer-brand img { width: 56px; height: 56px; border-radius: 50%; background: #fff; }
.footer-brand strong { display: block; font-family: var(--font-head); font-weight: 500; }
.footer-brand span { font-size: 14.5px; opacity: .85; }
.footer-links { display: flex; align-items: center; gap: 18px; font-size: 15px; }
.footer-links a { color: #fff; text-decoration: none; padding: 8px 14px; border-radius: 999px; background: rgba(255, 255, 255, .12); }
.footer-links a:hover { background: rgba(255, 255, 255, .2); }
.copyright { opacity: .75; }

/* ---------- Dialogs ---------- */
dialog.sheet {
  width: min(580px, calc(100% - 32px)); max-height: min(86vh, 760px); padding: 0; overflow: auto;
  border: 0; border-radius: var(--radius-xl); background: var(--surface); color: var(--ink); box-shadow: var(--shadow-lg);
}
dialog.sheet::backdrop { background: rgba(10, 24, 44, .45); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
dialog.sheet[open] { animation: rise .22s ease-out; }
.sheet-head { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; gap: 14px; padding: 20px 20px 16px 22px; background: var(--surface); border-bottom: 1px solid var(--line); }
.sheet-head > div { flex: 1; min-width: 0; }
.sheet-head h2 { font-size: 21px; }
.sheet-head p { margin: 2px 0 0; font-size: 14.5px; color: var(--muted); }
.sheet-icon { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 15px; font-size: 20px; flex: none; }
.option-list { display: grid; gap: 12px; padding: 18px 20px 22px; }
.option {
  display: flex; align-items: center; gap: 14px; min-height: 76px; padding: 14px 16px;
  border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface-2);
  text-decoration: none; color: inherit; transition: border-color .15s ease, transform .15s ease, background .15s ease;
}
.option:hover { border-color: var(--sky); background: var(--sky-50); transform: translateX(2px); }
.option-icon { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 14px; background: var(--surface); color: var(--sky-ink); font-size: 20px; flex: none; box-shadow: var(--shadow-sm); }
.option-text { flex: 1; min-width: 0; }
.option-text strong { display: block; font-family: var(--font-head); font-weight: 500; font-size: 17px; color: var(--navy); line-height: 1.35; }
.option-text span { font-size: 14px; color: var(--muted); }
.option-go { color: var(--sky-ink); }

.gate { display: grid; grid-template-columns: 170px 1fr; gap: 20px; align-items: center; padding: 22px; }
.gate-art { width: 170px; height: auto; }
.gate-body { display: grid; gap: 12px; }
.gate-body label { font-family: var(--font-head); font-size: 16px; color: var(--navy); }
.password-field { position: relative; }
.password-field input {
  width: 100%; height: 54px; padding: 0 56px 0 18px; border-radius: 14px;
  border: 2px solid var(--line); background: var(--surface-2); font-size: 18px; letter-spacing: .5px;
}
.password-field input:focus { outline: none; border-color: var(--sky-500); background: var(--surface); }
.reveal-btn { position: absolute; right: 5px; top: 5px; width: 44px; height: 44px; border-radius: 10px; border: 0; background: transparent; color: var(--muted); cursor: pointer; }
.form-error { margin: 0; padding: 10px 14px; border-radius: 12px; background: var(--rose-100); color: var(--rose-ink); font-size: 15px; }
.hint { margin: 0; font-size: 13.5px; color: var(--muted); }

/* ---------- Motion ---------- */
@keyframes pulse { 50% { box-shadow: 0 0 0 7px transparent; } }
@keyframes shimmer { to { background-position: -200% 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes fade-up { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.card-grid .card { animation: fade-up .35s ease-out both; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* ---------- Responsive ---------- */
@media (max-width: 1080px) {
  .layout { grid-template-columns: 1fr; }
  .side { position: static; grid-template-columns: 1fr 1fr; }
}
@media (max-width: 900px) {
  .clock { display: none; }
}
@media (min-width: 761px) and (max-width: 1180px) {
  .hero-art { left: 36%; }
  .hero::before { background: linear-gradient(90deg, rgba(242, 251, 255, .95) 0%, rgba(242, 251, 255, .85) 38%, rgba(242, 251, 255, 0) 62%); }
  [data-theme="dark"] .hero::before { background: linear-gradient(90deg, rgba(11, 24, 41, .95) 0%, rgba(11, 24, 41, .85) 38%, rgba(11, 24, 41, 0) 64%); }
  .hero-copy { max-width: 500px; }
}
@media (max-width: 760px) {
  body { font-size: 16px; }
  .wrap { width: min(100% - 28px, 1200px); }
  .topbar-inner { min-height: 64px; gap: 10px; }
  .brand-logo { width: 42px; height: 42px; }
  .brand-text strong { font-size: 15.5px; }
  .brand-text small { display: none; }
  .lang-switch button { min-width: 40px; }

  .hero { display: block; min-height: 0; background: linear-gradient(180deg, var(--sky-100) 0%, var(--bg) 100%); }
  .hero::before { display: none; }
  .hero-inner { padding: 26px 0 18px; }
  .hero-copy { max-width: none; text-align: left; }
  .status-pill { font-size: 13.5px; margin-bottom: 12px; }
  .greeting { font-size: 17px; }
  .hero h1 { font-size: 36px; }
  .lead { font-size: 16px; margin: 10px 0 18px; }
  .search-box { height: 58px; padding-left: 18px; }
  .search-box input { font-size: 17px; }
  .kbd-hint { display: none; }
  .hero-art { position: relative; inset: auto; z-index: 0; display: block; width: min(100% - 28px, 1200px); margin: 4px auto 0; border-radius: var(--radius-xl); overflow: hidden; aspect-ratio: 16 / 10; box-shadow: var(--shadow); }
  .hero-art img { object-position: 50% 85%; }
  [data-theme="dark"] .hero { background: linear-gradient(180deg, #10263f 0%, var(--bg) 100%); }
  .hero-wave { display: none; }

  .stats { margin-top: 18px; grid-template-columns: 1fr 1fr; }
  .stat { padding: 16px; gap: 10px; }
  .stat + .stat { border-left: 0; }
  .stat:nth-child(even) { border-left: 1px solid var(--line); }
  .stat:nth-child(n+3) { border-top: 1px solid var(--line); }
  .stat b { font-size: 23px; }
  .stat span:not(.stat-icon) { font-size: 13px; }
  .stat-icon { width: 38px; height: 38px; border-radius: 12px; font-size: 15px; }

  .layout { padding: 36px 0 48px; gap: 28px; }
  .side { grid-template-columns: 1fr; }
  .system-groups { gap: 26px; }
  .card-grid { grid-template-columns: 1fr; gap: 10px; }
  .card { flex-direction: row; align-items: center; min-height: 84px; padding: 14px 14px 14px 14px; gap: 14px; }
  .card::after { display: none; }
  .card-top { order: 0; }
  .card-go { display: none; }
  .card-icon { width: 52px; height: 52px; font-size: 21px; flex: none; }
  .card-body { flex: 1; min-width: 0; }
  .card h4 { margin: 0; font-size: 17px; }
  .card p { -webkit-line-clamp: 1; font-size: 14px; }
  .card-foot { display: none; }
  .card-mobile-go { display: grid !important; }
  .empty-state { flex-direction: column; text-align: center; padding: 24px 20px; gap: 12px; }
  .empty-state img { width: 120px; }

  dialog.sheet {
    width: 100%; max-width: 100%; max-height: 88vh; margin: auto 0 0; border-radius: 26px 26px 0 0;
    padding-bottom: env(safe-area-inset-bottom);
  }
  dialog.sheet[open] { animation: sheet-up .25s ease-out; }
  .gate { grid-template-columns: 1fr; justify-items: center; text-align: center; padding: 18px 20px 24px; }
  .gate-art { width: 130px; }
  .gate-body { width: 100%; text-align: left; }
  .footer-inner { flex-direction: column; align-items: flex-start; }
}
@keyframes sheet-up { from { transform: translateY(40px); opacity: .4; } to { transform: none; opacity: 1; } }

/* Card body wrapper is display:contents on wide screens so the column layout stays simple */
.card-body { display: contents; }
.card-mobile-go { display: none; color: var(--c-ink); flex: none; width: 28px; place-items: center; }
@media (max-width: 760px) { .card-body { display: block; } }

/* 404 */
.notfound { min-height: 100vh; display: grid; place-items: center; padding: 40px 0; }
.notfound h1 { font-size: 28px; margin-bottom: 6px; }
