/* Bai Jamjuree (SIL Open Font License 1.1) - self-hosted; see public/assets/fonts/OFL.txt */
@font-face{font-family:"Bai Jamjuree";font-style:normal;font-weight:400;font-display:swap;src:url("../fonts/bai-jamjuree-thai-400.woff2") format("woff2");unicode-range:U+02D7, U+0303, U+0331, U+0E01-0E5B, U+200C-200D, U+25CC;}
@font-face{font-family:"Bai Jamjuree";font-style:normal;font-weight:400;font-display:swap;src:url("../fonts/bai-jamjuree-latin-ext-400.woff2") format("woff2");unicode-range:U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;}
@font-face{font-family:"Bai Jamjuree";font-style:normal;font-weight:400;font-display:swap;src:url("../fonts/bai-jamjuree-latin-400.woff2") format("woff2");unicode-range:U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;}
@font-face{font-family:"Bai Jamjuree";font-style:normal;font-weight:500;font-display:swap;src:url("../fonts/bai-jamjuree-thai-500.woff2") format("woff2");unicode-range:U+02D7, U+0303, U+0331, U+0E01-0E5B, U+200C-200D, U+25CC;}
@font-face{font-family:"Bai Jamjuree";font-style:normal;font-weight:500;font-display:swap;src:url("../fonts/bai-jamjuree-latin-ext-500.woff2") format("woff2");unicode-range:U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;}
@font-face{font-family:"Bai Jamjuree";font-style:normal;font-weight:500;font-display:swap;src:url("../fonts/bai-jamjuree-latin-500.woff2") format("woff2");unicode-range:U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;}
@font-face{font-family:"Bai Jamjuree";font-style:normal;font-weight:600;font-display:swap;src:url("../fonts/bai-jamjuree-thai-600.woff2") format("woff2");unicode-range:U+02D7, U+0303, U+0331, U+0E01-0E5B, U+200C-200D, U+25CC;}
@font-face{font-family:"Bai Jamjuree";font-style:normal;font-weight:600;font-display:swap;src:url("../fonts/bai-jamjuree-latin-ext-600.woff2") format("woff2");unicode-range:U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;}
@font-face{font-family:"Bai Jamjuree";font-style:normal;font-weight:600;font-display:swap;src:url("../fonts/bai-jamjuree-latin-600.woff2") format("woff2");unicode-range:U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;}
@font-face{font-family:"Bai Jamjuree";font-style:normal;font-weight:700;font-display:swap;src:url("../fonts/bai-jamjuree-thai-700.woff2") format("woff2");unicode-range:U+02D7, U+0303, U+0331, U+0E01-0E5B, U+200C-200D, U+25CC;}
@font-face{font-family:"Bai Jamjuree";font-style:normal;font-weight:700;font-display:swap;src:url("../fonts/bai-jamjuree-latin-ext-700.woff2") format("woff2");unicode-range:U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;}
@font-face{font-family:"Bai Jamjuree";font-style:normal;font-weight:700;font-display:swap;src:url("../fonts/bai-jamjuree-latin-700.woff2") format("woff2");unicode-range:U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;}

:root {
  --color-primary: #3f5d5b;
  --color-primary-dark: #2e4645;
  --color-primary-light: #e8eeed;
  --color-primary-50: #f3f7f6;
  --color-surface: #ffffff;
  --color-surface-alt: #f7f8f8;
  --color-border: #dfe6e5;
  --color-text: #1f2a29;
  --color-text-muted: #5b6b6a;
  --color-success: #2f7a5c;
  --color-warning: #b8862b;
  --color-danger: #a5433a;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Bai Jamjuree", "Noto Sans Thai", system-ui, sans-serif;
  background: var(--color-surface);
  color: var(--color-text);
}

a { color: var(--color-primary); text-decoration: none; }
a:hover { color: var(--color-primary-dark); }

/* form controls do not inherit the page font by default */
button, input, select, textarea { font-family: inherit; }

.btn-primary {
  background: var(--color-primary);
  color: #fff;
  border: none;
  border-radius:0;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.btn-primary:hover { background: var(--color-primary-dark); }

.btn-outline {
  background: #fff;
  color: var(--color-primary);
  border: 1px solid var(--color-primary);
  border-radius:0;
  padding: 9px 16px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
}

input[type="text"], input[type="email"], input[type="password"], input[type="date"], input[type="number"], input[type="url"], input[type="search"], input[type="tel"], select {
  font-family: inherit;
  font-size: 14px;
  border: 1px solid var(--color-border);
  border-radius:0;
  padding: 9px 12px;
  color: var(--color-text);
  background: #fff;
}
input:focus, select:focus { outline: 2px solid var(--color-primary); outline-offset: 1px; }

.badge { white-space: nowrap; font-size: 10.5px; font-weight: 600; color: #fff; border-radius:0; padding: 3px 8px; display: inline-block; border: 1px solid transparent; }
.badge-public { background: #e3f1ea; color: #25664a; border-color: #bfdccd; }
.badge-request-required { background: #f8efd9; color: #8a6414; border-color: #e8d6a6; }
.badge-restricted { background: #f8e2e0; color: #a23a35; border-color: #ecbfbb; }

.nav-item { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-radius:0; font-size: 13.5px; color: rgba(255,255,255,.78); }
.nav-item:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav-item.active { background: var(--color-primary); color: #fff; font-weight: 600; }

/* ---- article body (public + editor) ---- */
.article-body img { max-width: 100%; height: auto; border-radius:0; margin: 12px 0; }
.article-body h2 { font-size: 22px; margin: 28px 0 10px; }
.article-body h3 { font-size: 18px; margin: 22px 0 8px; }
.article-body blockquote { margin: 16px 0; padding: 4px 18px; border-left: 4px solid var(--color-primary); color: var(--color-text-muted); }
.article-body a { text-decoration: underline; }

/* ---- visual editor ---- */
.wp-editor { margin-top: 6px; border: 1px solid var(--color-border); border-radius:0; background: #fff; }
.wp-toolbar { display: flex; flex-wrap: wrap; gap: 4px; padding: 8px; background: var(--color-surface-alt); border-bottom: 1px solid var(--color-border); border-radius:0; }
.wp-btn { border: 1px solid var(--color-border); background: #fff; border-radius:0; padding: 5px 10px; font-size: 13px; cursor: pointer; font-family: inherit; }
.wp-btn:hover, .wp-btn.on { background: var(--color-primary-light); border-color: var(--color-primary); }
.wp-area { min-height: 280px; padding: 14px 16px; font-size: 15px; line-height: 1.85; outline: none; }
.wp-area:focus { box-shadow: inset 0 0 0 2px var(--color-primary-light); }
.wp-editor textarea { width: 100%; margin: 0 !important; border: none !important; border-radius: 0 !important; font-family: monospace !important; font-size: 13px !important; min-height: 280px; }
.wp-panel { padding: 12px; border-bottom: 1px solid var(--color-border); background: var(--color-primary-50); font-size: 13px; }
.wp-panel[hidden] { display: none; }
.wp-row { display: flex; gap: 12px; align-items: center; margin: 8px 0; flex-wrap: wrap; }
.wp-status { color: var(--color-text-muted); font-size: 12.5px; }
.wp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; }
.wp-thumb { border: 1px solid var(--color-border); background: #fff; border-radius:0; padding: 0; cursor: pointer; overflow: hidden; height: 70px; }
.wp-thumb img { width: 100%; height: 100%; object-fit: cover; margin: 0; border-radius: 0; display: block; }
.wp-ref-btn { width: 100%; text-align: left; background: #fff; border: 1px solid var(--color-border); border-radius:0; padding: 8px 12px; font-size: 13px; cursor: pointer; font-family: inherit; }
.wp-ref-btn:hover { border-color: var(--color-primary); }

/* ---- icons, nav groups, site header ---- */
.icon { width: 18px; height: 18px; flex: 0 0 18px; }
.nav-group { font-size: 10.5px; color: rgba(255,255,255,.4); text-transform: uppercase; letter-spacing: .04em; margin: 16px 16px 6px; }
.nav-badge { margin-left: auto; background: var(--color-warning); color: #fff; font-size: 10.5px; font-weight: 700; border-radius:0; padding: 1px 7px; }
.sidebar-logo { background: #fff; border-radius:0; padding: 10px 14px; display: flex; align-items: center; justify-content: center; margin: 0 4px 6px; }
.sidebar-logo small { display: block; text-align: center; }

.site-header { background: #fff; border-bottom: 1px solid var(--color-border); }
.site-header .bar { max-width: 1280px; margin: 0 auto; padding: 8px 32px; display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.site-nav { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.site-nav a.link { color: var(--color-primary-dark); font-size: 14px; font-weight: 600; padding: 8px 12px; border-radius:0; }
.site-nav a.link:hover { background: var(--color-primary-light); }
.site-nav .who { color: var(--color-text-muted); font-size: 13px; text-decoration: underline; padding: 0 6px; }

/* signed-in user dropdown; stays an inline list when JS is off */
.user-menu { position: relative; }
.user-menu-btn { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border: 1px solid var(--color-border); background: #fff; color: var(--color-primary-dark); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; border-radius: 0; max-width: 240px; }
.user-menu-btn:hover, .user-menu.open .user-menu-btn { background: var(--color-primary-light); }
.user-menu-btn:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }
.user-menu-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-menu-caret { font-size: 11px; transition: transform .15s; }
.user-menu.open .user-menu-caret { transform: rotate(180deg); }
.user-menu-list { display: flex; flex-direction: column; }
.user-menu-list a, .user-menu-list button { display: block; width: 100%; box-sizing: border-box; padding: 11px 16px; border: 0; background: none; font: inherit; font-size: 14px; color: var(--color-text); text-align: left; text-decoration: none; cursor: pointer; border-radius: 0; }
.user-menu-list a:hover, .user-menu-list button:hover { background: var(--color-primary-light); }
.user-menu-list form { margin: 0; border-top: 1px solid var(--color-border); }
html.js .user-menu-list { display: none; position: absolute; right: 0; top: calc(100% + 6px); min-width: 200px; background: #fff; border: 1px solid var(--color-border); box-shadow: 0 12px 24px rgba(31,42,41,.14); z-index: 40; }
html.js .user-menu.open .user-menu-list { display: flex; }
.site-header .accent { height: 4px; background: var(--color-primary); }
.site-header { position: relative; z-index: 30; }

/* ---- home hero: photo behind the search block, veiled from the left so the text stays readable ---- */
.home-hero { position: relative; overflow: hidden; background: var(--color-primary-50); border-bottom: 1px solid var(--color-border); }

/* slideshow layers: pictures (cross-fade) < veil < content < controls */
.hero-slides { position: absolute; inset: 0; z-index: 0; }
.hero-slide { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center 30%; opacity: 0; transition: opacity 1.2s ease; }
.hero-slide.is-active { opacity: 1; }
.hero-veil { position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: linear-gradient(90deg, rgba(243,247,246,.97) 0%, rgba(243,247,246,.88) 38%, rgba(243,247,246,.28) 72%, rgba(243,247,246,0) 100%); }
@media (max-width: 860px) {
  .hero-veil { background: linear-gradient(180deg, rgba(243,247,246,.93) 0%, rgba(243,247,246,.80) 100%); }
}
.home-hero-inner { position: relative; z-index: 2; }

.hero-controls { position: absolute; z-index: 3; left: 0; right: 0; bottom: 14px; display: flex; justify-content: center; align-items: center; gap: 2px; }
.hero-dot { width: 30px; height: 28px; padding: 0; border: 0; background: none; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.hero-dot::before { content: ""; width: 12px; height: 12px; border-radius:0; border: 2px solid var(--color-primary-dark); background: rgba(255,255,255,.85); transition: width .25s ease, background .25s ease; }
.hero-dot[aria-current="true"]::before { width: 28px; background: var(--color-primary-dark); }
.hero-dot:focus-visible, .hero-pause:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; border-radius:0; }
.hero-pause { margin-left: 10px; width: 30px; height: 30px; border-radius:0; border: 1px solid var(--color-primary-dark); background: rgba(255,255,255,.85); color: var(--color-primary-dark); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; padding: 0; }
.hero-pause .icon { width: 14px; height: 14px; flex-basis: 14px; }
.hero-pause .when-paused { display: none; }
.hero-pause.is-paused .when-paused { display: block; }
.hero-pause.is-paused .when-playing { display: none; }
@media (prefers-reduced-motion: reduce) { .hero-slide, .hero-dot::before { transition: none; } }

/* hero content: compact by default (phones) ... */
.home-hero-inner { width: 100%; max-width: 1280px; margin: 0 auto; padding: 72px 32px 64px; box-sizing: border-box; }
.home-hero-title { margin: 0 0 12px; font-size: 34px; line-height: 1.4; max-width: 760px; }
.home-hero-lead { margin: 0 0 24px; font-size: 16px; line-height: 1.8; color: var(--color-text-muted); max-width: 720px; }
.home-hero-lead strong { color: var(--color-text); }
.home-hero-search { display: flex; gap: 10px; max-width: 640px; }
.home-hero-search input { flex: 1; min-width: 0; padding: 12px 14px; border-radius:0; font-size: 15px; }
.home-hero-search button { padding: 0 26px; border-radius:0; }

/* ... and filling the screen on iPad / laptop / desktop (>= 768px): content centred vertically, type and search box scale with the viewport */
@media (min-width: 768px) {
  .home-hero {
    display: flex; align-items: center;
    min-height: clamp(520px, calc(100vh - 76px), 900px);
    min-height: clamp(520px, calc(100svh - 76px), 900px);
  }
  .home-hero-inner { padding: 72px 32px; } /* same 1280px / 32px column as the header and the sections below, so left edges line up */
  .home-hero-title { font-size: clamp(38px, 4.6vw, 72px); line-height: 1.25; max-width: 15em; margin-bottom: clamp(14px, 1.6vw, 24px); }
  .home-hero-lead { font-size: clamp(16px, 1.45vw, 22px); line-height: 1.85; max-width: 38em; margin-bottom: clamp(26px, 3vw, 44px); }
  .home-hero-search { max-width: clamp(560px, 52vw, 860px); gap: 12px; }
  .home-hero-search input { padding: clamp(14px, 1.4vw, 20px) clamp(16px, 1.5vw, 22px); font-size: clamp(15px, 1.3vw, 19px); border-radius:0; box-shadow: 0 6px 22px rgba(46,70,69,.10); }
  .home-hero-search button { padding: 0 clamp(26px, 2.6vw, 40px); font-size: clamp(15px, 1.25vw, 18px); border-radius:0; }
}

/* ---- mission statement block (home, 2nd section) ---- */
.mission {
  display: grid;
  grid-template-columns: 1.18fr 1fr;
  border-radius:0;
  overflow: hidden;
  color: #fff;
  /* softer than the footer green: lightest stop still gives white text >= 4.5:1 contrast */
  background:
    radial-gradient(circle at 100% 0%, rgba(255,255,255,.08) 0, rgba(255,255,255,0) 42%),
    radial-gradient(circle at 0% 100%, rgba(255,255,255,.05) 0, rgba(255,255,255,0) 38%),
    linear-gradient(135deg, #5b7b79 0%, #527170 50%, #486664 100%);
  box-shadow: 0 18px 36px rgba(63,93,91,.14);
}
.mission-col { position: relative; padding: 48px 52px; }
.mission-th-col::before {
  content: "\201D"; position: absolute; top: 14px; right: 34px;
  font-size: 150px; line-height: 1; font-weight: 700; color: rgba(255,255,255,.08); pointer-events: none;
}
.mission-eyebrow {
  display: inline-block; margin-bottom: 20px; padding: 6px 14px; border-radius:0;
  background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.22);
  font-size: 12.5px; font-weight: 600; letter-spacing: .06em;
}
.mission-th { position: relative; margin: 0; font-size: 18.5px; line-height: 2.05; font-weight: 400; color: rgba(255,255,255,.96); }
.mission-th strong { font-weight: 700; color: #fff; background: linear-gradient(transparent 62%, rgba(255,255,255,.22) 62%); }
.mission-en { background: rgba(0,0,0,.07); border-left: 1px solid rgba(255,255,255,.18); }
.mission-en p { margin: 0; font-size: 15.5px; line-height: 1.9; color: rgba(255,255,255,.93); }
.mission-en strong { font-weight: 600; color: #fff; }

@media (max-width: 860px) {
  .mission { grid-template-columns: 1fr; border-radius:0; }
  .mission-col { padding: 32px 24px; }
  .mission-th-col::before { font-size: 110px; right: 16px; top: 10px; }
  .mission-th { font-size: 16.5px; line-height: 1.95; }
  .mission-en { border-left: 0; border-top: 1px solid rgba(255,255,255,.16); }
  .mission-en p { font-size: 14.5px; }
}

/* ---- mobile navbar ---- */
.nav-toggle { display: none; width: 44px; height: 44px; border: 1px solid var(--color-border); background: #fff; color: var(--color-primary-dark); border-radius:0; cursor: pointer; align-items: center; justify-content: center; padding: 0; }
.nav-toggle:hover { background: var(--color-primary-light); }
.nav-toggle:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }
.nav-toggle .icon { width: 22px; height: 22px; flex-basis: 22px; display: block; }
.nav-toggle .when-open, .nav-toggle.is-open .when-closed { display: none; }
.nav-toggle.is-open .when-open { display: block; }

@media (max-width: 860px) {
  .site-header .bar { padding: 8px 16px; flex-wrap: nowrap; }
  .site-logo img { height: 44px !important; width: auto !important; }
  .nav-toggle { display: inline-flex; }

  /* collapsed only when JS is present (see site-nav.js); otherwise the links just stay visible and wrap */
  html.js .site-nav { display: none; position: absolute; left: 0; right: 0; top: 100%; flex-direction: column; align-items: stretch; gap: 2px; padding: 8px 16px 18px; background: #fff; border-bottom: 1px solid var(--color-border); box-shadow: 0 14px 28px rgba(31,42,41,.14); }
  html.js .site-nav.open { display: flex; }
  .site-nav a.link { padding: 13px 12px; font-size: 15.5px; border-radius:0; }
  .site-nav .who { padding: 12px; text-decoration: none; border-top: 1px solid var(--color-border); margin-top: 6px; }
  .site-nav .btn-primary, .site-nav .btn-outline { width: 100%; text-align: center; padding: 12px 16px !important; font-size: 15px !important; margin-top: 6px; box-sizing: border-box; }
  .site-nav form { margin: 0; }
  /* inside the stacked phone menu the user menu is a plain section, not a floating popup */
  .user-menu { border-top: 1px solid var(--color-border); margin-top: 6px; padding-top: 6px; }
  .user-menu-btn { display: none; }
  html.js .user-menu-list, .user-menu-list { display: flex; position: static; min-width: 0; border: 0; box-shadow: none; }
  .user-menu-list a, .user-menu-list button { padding: 13px 12px; font-size: 15.5px; }
  .user-menu-list form { border-top: 0; }
}

@media (max-width: 860px) and (prefers-reduced-motion: no-preference) {
  html.js .site-nav.open { animation: navdrop .14s ease-out; }
}
@keyframes navdrop { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

/* ---- collapsible admin sidebar ---- */
.sidebar { width: 244px; flex: 0 0 244px; background: var(--color-primary-dark); display: flex; flex-direction: column; padding: 16px 12px; box-sizing: border-box; transition: width .18s ease, flex-basis .18s ease; position: sticky; top: 0; align-self: flex-start; height: 100vh; overflow-y: auto; z-index: 20; }
/* collapsed rail: let the hover labels poke out to the right (a scroll container would clip them) */
html.sb-collapsed .sidebar { overflow: visible; }
.sidebar-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 4px 10px; }
.sidebar-brand { color: #fff; text-decoration: none; padding: 4px 12px; min-width: 0; }
.sidebar-brand b { display: block; font-size: 22px; letter-spacing: .5px; line-height: 1.2; }
.sidebar-brand small { display: block; font-size: 11px; opacity: .6; margin-top: 2px; }
.sidebar-toggle { flex: 0 0 34px; height: 34px; border: 1px solid rgba(255,255,255,.2); background: transparent; color: rgba(255,255,255,.85); border-radius:0; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; position: relative; }
.sidebar-toggle:hover { background: rgba(255,255,255,.1); color: #fff; }
.sidebar .nav-item { position: relative; width: 100%; box-sizing: border-box; }
.sidebar .nav-item:focus-visible, .sidebar-toggle:focus-visible { outline: 2px solid #fff; outline-offset: 1px; }

/* collapsed: icons only; the label shows as a tooltip on hover / keyboard focus */
html.sb-collapsed .sidebar { width: 68px; flex-basis: 68px; padding-left: 10px; padding-right: 10px; }
html.sb-collapsed .sidebar-top { justify-content: center; padding-bottom: 12px; }
html.sb-collapsed .sidebar-brand { display: none; }
html.sb-collapsed .sidebar .nav-item { justify-content: center; padding-left: 0; padding-right: 0; gap: 0; }
html.sb-collapsed .sidebar .nav-label { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }
html.sb-collapsed .sidebar .nav-group { height: 1px; margin: 12px 10px; background: rgba(255,255,255,.14); font-size: 0; overflow: hidden; }
html.sb-collapsed .sidebar .nav-badge { position: absolute; top: 4px; right: 6px; margin: 0; padding: 0 5px; font-size: 9.5px; line-height: 15px; }

html.sb-collapsed .sidebar [data-label]:hover::after,
html.sb-collapsed .sidebar [data-label]:focus-visible::after {
  content: attr(data-label);
  position: absolute; left: calc(100% + 12px); top: 50%; transform: translateY(-50%);
  background: #1f2a29; color: #fff; font-size: 12.5px; font-weight: 600; line-height: 1;
  padding: 8px 11px; border-radius:0; white-space: nowrap; pointer-events: none;
  box-shadow: 0 4px 14px rgba(0,0,0,.25); z-index: 50;
}
html:not(.sb-collapsed) .sidebar-toggle[data-label]:hover::after {
  content: attr(data-label);
  position: absolute; right: 0; top: calc(100% + 8px);
  background: #1f2a29; color: #fff; font-size: 12.5px; font-weight: 600; line-height: 1;
  padding: 8px 11px; border-radius:0; white-space: nowrap; pointer-events: none; z-index: 50;
}

@media (prefers-reduced-motion: reduce) { .sidebar { transition: none; } }

/* exhibition list: one exhibition per full-width row */
.ex-rows { display: flex; flex-direction: column; gap: 22px; margin-bottom: 38px; }
.ex-row { display: flex; align-items: stretch; background: #fff; border: 1px solid var(--color-border); border-radius: 0; overflow: hidden; color: var(--color-text); transition: box-shadow .15s ease, border-color .15s ease; }
.ex-row:hover { box-shadow: 0 6px 22px rgba(63, 93, 91, .16); border-color: var(--color-primary-light); }
.ex-row-media { flex: 0 0 42%; max-width: 560px; min-height: 240px; background: var(--color-primary-light); display: block; position: relative; }
.ex-row-media > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.ex-row-noimg { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.ex-row-noimg img { opacity: .5; }
.ex-row-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; justify-content: center; padding: 26px 32px; }
.ex-row-body h3 { margin: 0; font-size: 24px; line-height: 1.45; }
.ex-row-en { font-size: 14px; color: var(--color-text-muted); }
.ex-row-teaser { font-size: 15px; line-height: 1.85; color: var(--color-text-muted); }
.ex-row-meta { font-size: 13px; color: var(--color-text-muted); }
.ex-row-more { margin-top: 6px; font-size: 14px; font-weight: 600; color: var(--color-primary); }
@media (max-width: 760px) {
  .ex-row { flex-direction: column; }
  .ex-row-media { flex: none; max-width: none; min-height: 0; aspect-ratio: 16 / 9; }
  .ex-row-body { padding: 18px 20px 22px; }
  .ex-row-body h3 { font-size: 19px; }
}

/* archive reference card preview popup */
.archive-ref-card { cursor: pointer; transition: box-shadow .15s ease, border-color .15s ease; }
.archive-ref-card:hover { box-shadow: 0 2px 10px rgba(63, 93, 91, .18); }
.pv-dialog { border: 0; border-radius:0; padding: 0; width: min(520px, calc(100vw - 32px)); max-height: calc(100vh - 48px); overflow: auto; box-shadow: 0 20px 60px rgba(0,0,0,.3); color: var(--color-text); }
.pv-dialog::backdrop { background: rgba(30, 45, 44, .55); }
.pv-close { position: absolute; top: 10px; right: 10px; z-index: 2; width: 34px; height: 34px; border-radius:0; border: 0; background: rgba(255,255,255,.9); color: var(--color-text); font-size: 22px; line-height: 1; cursor: pointer; box-shadow: 0 1px 4px rgba(0,0,0,.25); padding: 0 0 2px; }
.pv-media { background: var(--color-surface-alt); border-bottom: 1px solid var(--color-border); display: flex; justify-content: center; }
.pv-media[hidden] { display: none; }
.pv-media img { display: block; max-width: 100%; max-height: 300px; width: auto; height: auto; object-fit: contain; }
.pv-body { padding: 18px 22px 20px; display: flex; flex-direction: column; gap: 10px; }
.pv-badge { align-self: flex-start; }
.pv-title { margin: 0; font-size: 19px; line-height: 1.5; padding-right: 30px; }
.pv-meta { margin: 0; display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.pv-meta div { display: flex; gap: 12px; }
.pv-meta dt { flex: 0 0 84px; color: var(--color-text-muted); }
.pv-meta dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.pv-desc { margin: 0; font-size: 14px; line-height: 1.75; color: var(--color-text); }
.pv-note { margin: 0; font-size: 12.5px; color: var(--color-text-muted); background: var(--color-primary-50); border-radius:0; padding: 8px 12px; }
.pv-desc[hidden], .pv-note[hidden] { display: none; }
.pv-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 6px; }
.pv-link { text-decoration: none; display: inline-flex; align-items: center; }

/* YouTube player inside article / exhibition text */
.video-embed { display: block; position: relative; aspect-ratio: 16 / 9; margin: 20px 0; border-radius:0; overflow: hidden; background: #000; }
.video-embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* PDF viewer on the item page, with a full-screen toggle */
.pdf-frame { background: #fff; border: 1px solid var(--color-border); border-radius:0; overflow: hidden; display: flex; flex-direction: column; }
.pdf-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 12px; background: var(--color-surface-alt); border-bottom: 1px solid var(--color-border); font-size: 13px; }
.pdf-full { display: inline-flex; align-items: center; gap: 6px; background: var(--color-primary); color: #fff; border: 0; border-radius:0; padding: 6px 12px; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.pdf-full[hidden] { display: none; }
.pdf-full .icon { width: 16px; height: 16px; flex-basis: 16px; }
.pdf-full:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }
.pdf-frame iframe { display: block; width: 100%; height: 560px; border: 0; }
.pdf-frame:fullscreen { border-radius: 0; border: 0; height: 100vh; }
.pdf-frame:fullscreen iframe { flex: 1; height: auto; }
.pdf-frame:-webkit-full-screen { border-radius: 0; border: 0; height: 100vh; }
.pdf-frame:-webkit-full-screen iframe { flex: 1; height: auto; }

/* several PDFs: list under the preview, click swaps the preview */
.pdf-list { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.pdf-item { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; background: #fff; border: 1px solid var(--color-border); border-radius:0; padding: 10px 12px; font: inherit; font-size: 13.5px; color: var(--color-text); cursor: pointer; transition: border-color .15s, background .15s; }
.pdf-item:hover { background: var(--color-primary-50); }
.pdf-item[aria-current="true"] { border-color: var(--color-primary); background: var(--color-primary-50); }
.pdf-item:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }
.pdf-badge { flex: 0 0 auto; background: var(--color-primary); color: #fff; font-size: 11px; font-weight: 700; border-radius:0; padding: 4px 8px; }
.pdf-item-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.pdf-item-note { color: var(--color-text-muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pdf-item-size { flex: 0 0 auto; color: var(--color-text-muted); font-size: 12px; }
@media (prefers-reduced-motion: reduce) { .pdf-item { transition: none; } }

/* item page gallery: big picture + small thumbnails that swap it */
.gallery { margin: 0 0 22px; }
.g-stage { position: relative; background: var(--color-surface-alt); border: 1px solid var(--color-border); border-radius:0; overflow: hidden; display: flex; align-items: center; justify-content: center; min-height: 220px; }
.g-main { display: block; max-width: 100%; max-height: 640px; width: auto; height: auto; transition: opacity .2s ease; }
.gallery.is-loading .g-main { opacity: .45; }
.g-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 38px; height: 38px; border-radius:0; border: 0; background: rgba(255,255,255,.88); color: var(--color-primary-dark); font-size: 24px; line-height: 1; cursor: pointer; padding: 0 0 3px; box-shadow: 0 1px 4px rgba(0,0,0,.2); }
.g-prev { left: 10px; } .g-next { right: 10px; }
.g-nav:focus-visible, .g-thumb:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }
.g-counter { position: absolute; right: 10px; bottom: 10px; background: rgba(0,0,0,.55); color: #fff; font-size: 12px; border-radius:0; padding: 2px 10px; }
.g-caption { font-size: 12.5px; color: var(--color-text-muted); margin-top: 8px; }
.g-note { display: block; color: var(--color-text); font-size: 13.5px; line-height: 1.6; margin-bottom: 2px; }
.g-note:empty { display: none; }
.g-thumbs { list-style: none; margin: 12px 0 0; padding: 0 0 4px; display: flex; gap: 8px; overflow-x: auto; }
.g-thumb { display: block; padding: 0; border: 2px solid transparent; border-radius:0; background: none; cursor: pointer; opacity: .7; transition: opacity .15s, border-color .15s; }
.g-thumb img { display: block; width: 88px; height: 66px; object-fit: cover; border-radius:0; background: var(--color-border); }
.g-thumb:hover { opacity: 1; }
.g-thumb[aria-current="true"] { border-color: var(--color-primary); opacity: 1; }
@media (max-width: 640px) { .g-thumb img { width: 72px; height: 54px; } .g-main { max-height: 420px; } }
@media (prefers-reduced-motion: reduce) { .g-main, .g-thumb { transition: none; } }

/* attached files list (admin item form) */
.file-row { display: flex; align-items: flex-start; gap: 12px; font-size: 13px; border: 1px solid var(--color-border); border-radius:0; padding: 10px 12px; }
.file-thumb { flex: 0 0 56px; width: 56px; height: 56px; border-radius:0; object-fit: cover; background: var(--color-border); display: block; }
.file-thumb-type { display: flex; align-items: center; justify-content: center; background: var(--color-primary-50); color: var(--color-primary-dark); font-size: 11px; font-weight: 700; border: 1px solid var(--color-primary-light); box-sizing: border-box; }
.file-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.file-title { overflow-wrap: anywhere; line-height: 1.5; }
.file-note { display: flex; gap: 8px; margin: 0; }
.file-note input { flex: 1; min-width: 0; font-size: 13px; }

/* "add a video by link" form under the uploaded files (admin item form) */
.link-form { margin-top: 18px; padding-top: 16px; border-top: 1px dashed var(--color-border); }
.link-form h3 { margin: 0 0 10px; font-size: 13.5px; }
.link-form-row { display: flex; gap: 8px; flex-wrap: wrap; }
.link-form-row input { flex: 1 1 220px; min-width: 0; }
.link-form-row input[name="note"] { flex: 1 1 160px; }

/* delete confirmation dialog */
.confirm-dialog { border: 0; border-radius:0; padding: 24px 26px 20px; width: min(400px, calc(100vw - 32px)); box-shadow: 0 20px 60px rgba(0,0,0,.25); color: var(--color-text); }
.confirm-dialog::backdrop { background: rgba(30, 45, 44, .5); }
.confirm-dialog h2 { margin: 0 0 8px; font-size: 18px; }
.confirm-text { margin: 0 0 20px; font-size: 14.5px; line-height: 1.7; color: var(--color-text-muted); }
.confirm-actions { display: flex; justify-content: flex-end; gap: 10px; }
.confirm-ok { background: var(--color-danger); border-color: var(--color-danger); }

/* tag groups board (admin tag manager) */
.tg-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(250px, 340px); gap: 16px; align-items: start; }
.tg-left { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.tg-picker { display: flex; align-items: center; gap: 10px; margin: 0; }
.tg-picker-label { font-size: 13px; color: var(--color-text-muted); white-space: nowrap; }
.tg-picker select { flex: 1; min-width: 0; max-width: 380px; }
.tg-empty { margin: 0; padding: 22px; text-align: center; font-size: 13px; color: var(--color-text-muted); background: #fff; border: 1px dashed var(--color-border); border-radius:0; }
.tg-box[hidden] { display: none; }
.tg-box { min-height: 180px; }
.tg-filter { width: 100%; box-sizing: border-box; font-size: 13px; }
.tg-only { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--color-text-muted); }
.tg-hint { margin: 8px 2px 0; font-size: 12px; line-height: 1.6; color: var(--color-text-muted); }
.tg-rowgroups { font-size: 13px; position: relative; }
.tg-rowgroups summary { cursor: pointer; border: 1px solid var(--color-border); border-radius:0; padding: 9px 12px; background: #fff; list-style: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tg-rowgroups summary::-webkit-details-marker { display: none; }
.tg-rowgroups[open] summary { border-color: var(--color-primary); }
/* the group choices float over the rows below instead of making this row taller */
.tg-rowgroups-list { position: absolute; z-index: 30; top: calc(100% + 4px); left: 0; min-width: 100%; width: max-content; max-width: 280px; display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; background: #fff; border: 1px solid var(--color-border); border-radius:0; box-shadow: 0 8px 24px rgba(0,0,0,.14); max-height: 220px; overflow-y: auto; }
.tg-rowgroups-list label { display: flex; align-items: center; gap: 6px; }

/* tag manager list: one tag = one line */
.tx-list { background: #fff; border: 1px solid var(--color-border); border-radius:0; }
.tx-row { display: grid; grid-template-columns: minmax(130px, 1.1fr) minmax(130px, 1.1fr) minmax(150px, 1.5fr) 128px 76px 78px 82px 34px; gap: 10px; align-items: center; padding: 9px 16px; }
.tx-row + .tx-row { border-top: 1px solid var(--color-border); }
.tx-row.tx-simple { grid-template-columns: minmax(150px, 1fr) minmax(150px, 1fr) 76px 78px 82px 34px; }
.tx-form { display: contents; }
.tx-row input[type="text"] { width: 100%; min-width: 0; box-sizing: border-box; font-size: 13.5px; padding: 8px 10px; }
.tx-save { padding: 7px 12px; }
.tx-num { font-size: 12px; color: var(--color-text-muted); text-align: right; white-space: nowrap; }
.tx-merge { font-size: 13px; white-space: nowrap; }
.tx-del { background: none; border: none; color: var(--color-danger); cursor: pointer; font-size: 13px; padding: 0; }
.tx-nogroup { font-size: 12px; color: var(--color-text-muted); }
.tx-head { font-size: 12px; color: var(--color-text-muted); font-weight: 600; background: var(--color-surface-alt); border-radius:0; padding-top: 8px; padding-bottom: 8px; }
@media (max-width: 1060px) {
  /* narrower screens: two lines per tag instead of an overflowing single line */
  .tx-head { display: none; }
  .tx-row, .tx-row.tx-simple { grid-template-columns: repeat(4, minmax(0, 1fr)); row-gap: 8px; padding: 12px 16px; }
  .tx-row input[name="name_th"], .tx-row input[name="name_en"], .tx-row .tg-rowgroups, .tx-row .tx-nogroup, .tx-save { grid-column: span 2; }
  .tx-num { text-align: left; }
}
.tg-list-scroll { max-height: 440px; overflow-y: auto; }
.tg-chip[hidden] { display: none; }
@media (max-width: 760px) { .tg-layout { grid-template-columns: 1fr; } }
.tg-box { background: #fff; border: 1px solid var(--color-border); border-radius:0; padding: 12px; display: flex; flex-direction: column; gap: 10px; min-height: 110px; transition: border-color .15s, background .15s; }
.tg-box.is-over { border-color: var(--color-primary); background: var(--color-primary-50); }
.tg-none { background: var(--color-surface-alt); border-style: dashed; }
.tg-head { font-size: 14px; }
.tg-rename summary { cursor: pointer; list-style: none; }
.tg-rename summary::-webkit-details-marker { display: none; }
.tg-count { display: inline-block; min-width: 20px; text-align: center; font-size: 11px; background: var(--color-primary-50); color: var(--color-primary-dark); border-radius:0; padding: 1px 7px; margin-left: 4px; }
.tg-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; flex: 1; align-content: flex-start; min-height: 40px; }
.tg-chip { background: var(--color-primary-50); border: 1px solid var(--color-primary-light); border-radius:0; padding: 4px 12px; font-size: 13px; cursor: grab; user-select: none; }
.tg-chip small { color: var(--color-text-muted); margin-left: 4px; }
.tg-chip.is-dragging { opacity: .4; }

/* related-items picker (admin item form) */
.rel-chips { list-style: none; margin: 0 0 10px; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.rel-chip { display: inline-flex; align-items: center; gap: 8px; background: var(--color-primary-50); border: 1px solid var(--color-primary-light); border-radius:0; padding: 4px 6px 4px 12px; font-size: 13px; max-width: 100%; }
.rel-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rel-remove { border: 0; background: rgba(0,0,0,.08); color: var(--color-text); width: 22px; height: 22px; border-radius:0; cursor: pointer; font-size: 15px; line-height: 1; padding: 0; flex: 0 0 22px; }
.rel-remove:hover { background: var(--color-danger); color: #fff; }
.rel-results { list-style: none; margin: 6px 0 0; padding: 4px; border: 1px solid var(--color-border); border-radius:0; background: #fff; max-height: 280px; overflow-y: auto; }
.rel-results[hidden] { display: none; }
.rel-results button { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; border: 0; background: none; padding: 8px 10px; border-radius:0; cursor: pointer; font: inherit; font-size: 13.5px; }
.rel-results button:hover, .rel-results button:focus-visible { background: var(--color-primary-50); }
.rel-results .rel-empty { padding: 10px; font-size: 13px; color: var(--color-text-muted); }

/* latest exhibitions slider (home): the whole cover is shown, not cropped */
.ex-slider { position: relative; border-radius:0; overflow: hidden; border: 1px solid var(--color-border); background: var(--color-primary-50); }
.ex-track { position: relative; aspect-ratio: 16 / 9; max-height: 640px; width: 100%; }
.ex-slide { position: absolute; inset: 0; opacity: 0; visibility: hidden; transition: opacity .8s ease, visibility .8s; display: block; }
.ex-slide.is-active { opacity: 1; visibility: visible; }
.ex-slide img { width: 100%; height: 100%; object-fit: contain; display: block; }
.ex-noimg { width: 100%; height: 100%; background: var(--color-primary-light); display: flex; align-items: center; justify-content: center; opacity: .9; }
.ex-caption { position: absolute; left: 0; right: 0; bottom: 0; padding: 40px 24px 46px; color: #fff; display: flex; flex-direction: column; gap: 2px; background: linear-gradient(180deg, rgba(40,60,58,0) 0%, rgba(40,60,58,.72) 100%); }
.ex-caption strong { font-size: 20px; line-height: 1.4; }
.ex-caption span { font-size: 13.5px; opacity: .9; }
.ex-nav { position: absolute; top: 50%; transform: translateY(-50%); z-index: 2; width: 40px; height: 40px; border-radius:0; border: 0; background: rgba(255,255,255,.85); color: var(--color-primary-dark); font-size: 26px; line-height: 1; cursor: pointer; padding: 0 0 3px; }
.ex-prev { left: 12px; } .ex-next { right: 12px; }
.ex-dots { position: absolute; z-index: 2; left: 0; right: 0; bottom: 10px; display: flex; justify-content: center; }
.ex-dot { width: 28px; height: 26px; padding: 0; border: 0; background: none; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.ex-dot::before { content: ""; width: 10px; height: 10px; border-radius:0; background: rgba(255,255,255,.6); transition: width .25s ease, background .25s ease; }
.ex-dot[aria-current="true"]::before { width: 26px; background: #fff; }
.ex-nav:focus-visible, .ex-dot:focus-visible, .ex-slide:focus-visible { outline: 2px solid #fff; outline-offset: -4px; }
@media (max-width: 640px) { .ex-caption { padding: 28px 16px 40px; } .ex-caption strong { font-size: 16px; } .ex-nav { width: 34px; height: 34px; } }
@media (prefers-reduced-motion: reduce) { .ex-slide, .ex-dot::before { transition: none; } }

/* small cover preview in admin lists (articles, exhibitions) */
.list-cover { display: block; width: 64px; height: 44px; object-fit: cover; border-radius:0; border: 1px solid var(--color-border); background: var(--color-border); }
.list-cover-none { display: flex; align-items: center; justify-content: center; background: var(--color-primary-light); opacity: .9; box-sizing: border-box; }
.list-cover-none img { opacity: .55; height: 14px; width: auto; }

/* ---- admin on phones: sidebar becomes an off-canvas drawer, list tables become cards ---- */
.admin-mobilebar, .sidebar-close, .sb-backdrop { display: none; }
@media (max-width: 860px) {
  .admin-mobilebar { display: flex; align-items: center; gap: 12px; position: sticky; top: 0; z-index: 30; height: 52px; padding: 0 12px; background: var(--color-primary-dark); color: #fff; }
  .mobilebar-btn { width: 40px; height: 40px; border: 1px solid rgba(255,255,255,.25); background: transparent; color: #fff; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; }
  .mobilebar-brand { color: #fff; text-decoration: none; font-size: 15px; }
  .mobilebar-brand small { opacity: .65; font-size: 11.5px; margin-left: 4px; }

  .sidebar, html.sb-collapsed .sidebar { position: fixed; top: 0; bottom: 0; left: 0; width: min(280px, 86vw); flex-basis: auto; height: 100%; padding: 16px 12px; overflow-y: auto; transform: translateX(-100%); transition: transform .2s ease; z-index: 50; }
  html.sb-open .sidebar { transform: translateX(0); box-shadow: 6px 0 24px rgba(0,0,0,.3); }
  .sb-backdrop:not([hidden]) { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 40; }
  .sidebar-toggle { display: none; }
  .sidebar-close { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 34px; height: 34px; border: 1px solid rgba(255,255,255,.2); background: transparent; color: #fff; cursor: pointer; padding: 0; }
  /* a rail collapsed on desktop must still show full labels in the drawer */
  html.sb-collapsed .sidebar-top { justify-content: space-between; padding-bottom: 10px; }
  html.sb-collapsed .sidebar-brand { display: block; }
  html.sb-collapsed .sidebar .nav-item { justify-content: flex-start; padding-left: 16px; padding-right: 16px; gap: 12px; }
  html.sb-collapsed .sidebar .nav-label { position: static; width: auto; height: auto; margin: 0; overflow: visible; clip: auto; }
  html.sb-collapsed .sidebar .nav-group { height: auto; margin: 0; background: none; font-size: inherit; overflow: visible; }
  html.sb-collapsed .sidebar .nav-badge { position: static; margin-left: auto; padding: 1px 7px; font-size: 10.5px; line-height: normal; }
  html.sb-collapsed .sidebar [data-label]:hover::after, html.sb-collapsed .sidebar [data-label]:focus-visible::after { content: none; }
  html.sb-open { overflow: hidden; }
}
@media (max-width: 760px) {
  .page-head { padding: 12px 16px !important; flex-wrap: wrap; }
  .page-head h1 { font-size: 16px !important; }
  .page-main { padding: 16px !important; }
  .filter-form { padding: 12px !important; }
  .filter-form > * { flex: 1 1 100% !important; min-width: 0; width: 100%; }

  .ai-table, .ai-table tbody, .ai-table tr, .ai-table td { display: block; width: 100%; box-sizing: border-box; }
  .ai-table thead { display: none; }
  .ai-table tr { border-bottom: 1px solid var(--color-border); padding: 10px 14px; }
  .ai-table td { display: flex !important; justify-content: space-between; align-items: baseline; gap: 14px; padding: 5px 0 !important; border: 0 !important; max-width: none !important; text-align: right; }
  .ai-table td[data-label]::before { content: attr(data-label); flex: 0 0 auto; font-size: 11.5px; color: var(--color-text-muted); text-align: left; }
  .ai-table td.ai-id { font-size: 13px !important; font-weight: 700; }
  .ai-table td.ai-title { font-weight: 600; }
  .ai-table td.ai-actions { justify-content: flex-start; padding-top: 10px !important; gap: 4px; }
  .ai-table td.ai-actions a, .ai-table td.ai-actions button { font-size: 14px !important; padding: 6px 4px; }
  .ai-table td.ai-empty { justify-content: center; }
  .pager { justify-content: center !important; }
}

/* in-page jump links (e.g. "go to uploaded files") */
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
#media-section { scroll-margin-top: 16px; }
@media (max-width: 860px) { #media-section { scroll-margin-top: 68px; } }
