/* ธีมมืดกลาง (แนว Recode) ใช้ทุกหน้า ยกเว้นหน้าแรกที่มีธีมของตัวเอง
 * ผูกไว้ใต้ @media screen → สั่งพิมพ์ยังเป็นกระดาษขาวตามค่าเดิมของแต่ละหน้า */
@media screen {
  :root {
    --navy:#4a8f50; --navy-dark:#0b120c; --gold:#e0233f; --red:#ff6b7d; --green:#7fd38a;
    --ink:#e8eee6; --muted:#97a596; --line:#223026; --bg:#070b08; --white:#0e150f;
    --card:#0e150f; --tint-red:rgba(255,107,125,.10); --tint-gold:rgba(233,196,106,.10); --tint-violet:rgba(160,120,255,.10); --tint-green:rgba(127,211,138,.13); --tint-gray:rgba(255,255,255,.06);
    --gold-light:rgba(255,107,125,.12); --amber:#f2c24f; --red-ink:#ff8a98;
    --acc:#b6f06e; --acc-ink:#0b1607;
    color-scheme: dark;
  }
  html, body { background:#070b08; color:var(--ink) }
  .flagbar { display:none }
  header { background:rgba(9,13,10,.92)!important; border-bottom:1px solid var(--line)!important; backdrop-filter:blur(8px) }
  .brand b { color:#fff!important }
  input, select, textarea { border-color:#2c3b2f!important; background:#0a100b!important; color:var(--ink)!important }
  input[type=password], input[type=number], input[type=date], input[type=time] { padding:10px 12px; border:1px solid; border-radius:8px; font:inherit; font-size:16px }
  input:focus, select:focus, textarea:focus { outline-color:var(--acc)!important; border-color:var(--acc)!important }
  .card, .box, .panel, .modal, dialog { border-color:var(--line) }
  a { color:inherit }
  main a:not([class]) { color:var(--acc) }
  footer { background:#040705!important; border-top:1px solid var(--line); color:var(--muted)!important }
  h1, h2, h3, .page-title, label { color:#fff!important }
  .btn-navy { background:var(--acc)!important; color:var(--acc-ink)!important }
  .btn-navy:hover { filter:brightness(1.08) }
  #langToggle, #siteSearchBtn { background:transparent!important; color:#fff!important; border-color:#2c3b2f!important }
  #langToggle:hover { background:var(--acc)!important; color:var(--acc-ink)!important }
  #siteSearch .box { background:#0e150f!important; border:1px solid var(--line) }
  #siteSearch input { background:transparent!important; border:0!important; border-bottom:1px solid var(--line)!important }
  #siteSearch li a { color:var(--ink)!important } #siteSearch li a b { color:#fff!important } #siteSearch li a small { color:var(--muted)!important }
  ::selection { background:var(--acc); color:var(--acc-ink) }

  /* ธีม HHIS: ทุกหน้าของ tenant hhis ใช้โทนเดียวกับหน้าแรก (พื้นสว่าง หัวขาว ท้ายน้ำเงิน ปุ่ม coral ตาม accent) */
  body[data-tenant="hhis"] {
    --navy:#1e5bd6; --navy-dark:#163f9e; --red:#f43f5e; --green:#1e9e6a;
    --ink:#23272f; --muted:#6b7280; --line:#e3e7ee; --bg:#ffffff; --white:#ffffff;
    --card:#ffffff; --tint-red:rgba(244,63,94,.08); --tint-gold:rgba(255,196,0,.20); --tint-violet:rgba(30,91,214,.08); --tint-green:rgba(30,158,106,.10); --tint-gray:rgba(35,39,47,.05);
    --gold-light:rgba(255,196,0,.22); --amber:#d9a400; --red-ink:#d61f42;
    color-scheme:light;
  }
  body[data-tenant="hhis"] { background:#fff }
  body[data-tenant="hhis"] header { background:#fff!important; border-bottom:1px solid var(--line)!important }
  body[data-tenant="hhis"] .brand b { color:var(--navy)!important }
  body[data-tenant="hhis"] input, body[data-tenant="hhis"] select, body[data-tenant="hhis"] textarea { background:#fff!important; border-color:var(--line)!important }
  body[data-tenant="hhis"] footer { background:var(--navy)!important; color:#fff!important }
  body[data-tenant="hhis"] h1, body[data-tenant="hhis"] h2, body[data-tenant="hhis"] h3, body[data-tenant="hhis"] .page-title { color:var(--navy)!important }
  body[data-tenant="hhis"] label { color:var(--ink)!important }
  body[data-tenant="hhis"] #langToggle, body[data-tenant="hhis"] #siteSearchBtn { color:var(--navy)!important; border-color:var(--line)!important }
  body[data-tenant="hhis"] #siteSearch .box { background:#fff!important }
  body[data-tenant="hhis"] #siteSearch li a { color:var(--ink)!important }
  body[data-tenant="hhis"] #siteSearch li a b { color:var(--navy)!important }
  body[data-tenant="hhis"] #siteSearch li a small { color:var(--muted)!important }
  body[data-tenant="hhis"] .hdr-badge { color:#f9615c }
  body[data-tenant="hhis"] .hdr-badge .badge-core { background:linear-gradient(145deg,#5b8def,#1e5bd6) }
}

/* ตราโรงเรียนมุมซ้ายบน: วงแดงตัวอักษรหมุน + หกเหลี่ยม */
.hdr-badge{position:relative;flex:none;width:64px;height:64px;color:#b6f06e;border-radius:50%;background:radial-gradient(circle,#0d160f 62%,transparent 63%)}
.hdr-badge .badge-ring{position:absolute;inset:0;width:100%;height:100%}
.hdr-badge .badge-ring text{font-size:15px}
@media(prefers-reduced-motion:no-preference){.hdr-badge .badge-ring{animation:hdrSpin 22s linear infinite}}
@keyframes hdrSpin{to{transform:rotate(360deg)}}
.hdr-badge .badge-core{position:absolute;inset:14px;display:grid;place-items:center;background:linear-gradient(145deg,#c6f585,#5f9a4e);clip-path:polygon(50% 0,93% 25%,93% 75%,50% 100%,7% 75%,7% 25%)}
.brand .hdr-badge img{width:76%!important;height:auto!important;border:0!important;border-radius:50%}
@media(max-width:480px){.hdr-badge{width:50px;height:50px}.hdr-badge .badge-core{inset:11px}}
