/* E-Borrow — mobile-first
   นักเรียนใช้มือถือเป็นหลัก desktop เป็น progressive enhancement */

:root {
  /* ส้มแบบร้านค้าออนไลน์ เข้มขึ้นเล็กน้อยให้ตัวขาวบนส้มอ่านชัด (5.2:1 ผ่าน WCAG AA) */
  --brand: #cc3418;
  --brand-dark: #a92912;
  --brand-light: #fff1ee;
  --ink: #1f2937;
  --ink-soft: #5f6672;        /* ข้อความรอง — ผ่าน 4.5:1 ทั้งบนขาวและบนพื้นเทา */
  --ink-faint: #9ca3af;       /* ของตกแต่งเท่านั้น ห้ามใช้กับข้อความ */
  --line: #e5e7eb;
  --bg: #f5f5f5;
  --surface: #ffffff;
  --ok: #10b981;
  --ok-bg: #ecfdf5;
  --warn: #f59e0b;
  --warn-bg: #fffbeb;
  --danger: #ef4444;
  --danger-bg: #fef2f2;
  --info: #3b82f6;
  --info-bg: #eff6ff;
  /* สีสถานะสำหรับ "ตัวอักษร" — สีด้านบนสว่างเกินจะใช้เป็นตัวหนังสือบนพื้นขาว */
  --ok-ink: #047857;
  --warn-ink: #b45309;
  --danger-ink: #b91c1c;
  --info-ink: #1d4ed8;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(0,0,0,.08);
  --shadow-lg: 0 4px 16px rgba(0,0,0,.12);
  --header-h: 56px;
  --font: 'Sarabun', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0 0 .5em; line-height: 1.3; font-weight: 600; }
h1 { font-size: 1.35rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 .75em; }
a { color: var(--brand); text-decoration: none; }

/* ไอคอนเส้นจาก UI.icon() — ขนาดตามตัวอักษรรอบๆ */
.icon { width: 1.15em; height: 1.15em; flex-shrink: 0; vertical-align: -.2em; }

/* กรอบโฟกัสเวลาใช้คีย์บอร์ด (ไม่โผล่ตอนแตะนิ้ว) */
:focus-visible { outline: 3px solid #1d4ed8; outline-offset: 2px; border-radius: 4px; }
.app-header :focus-visible { outline-color: #fff; }

/* ---------- layout ---------- */

.page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 16px;
  padding-bottom: 80px;
}

.page--narrow { max-width: 460px; }

.section { margin-bottom: 24px; }

.section__title {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 12px;
}

/* ---------- header ---------- */

.app-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--brand);
  color: #fff;
  box-shadow: var(--shadow);
}

.app-header__inner {
  max-width: 1100px; margin: 0 auto;
  height: var(--header-h);
  padding: 0 12px;
  display: flex; align-items: center; gap: 12px;
}

.app-header__brand {
  display: flex; align-items: center; gap: 6px;
  color: #fff; font-weight: 700; font-size: 1.05rem;
  white-space: nowrap;
}
.app-header__logo { width: 1.3em; height: 1.3em; }

.app-header__nav { display: none; gap: 4px; margin-left: 12px; flex: 1; }
.app-header__nav a {
  color: rgba(255,255,255,.85); padding: 6px 12px;
  border-radius: 6px; font-size: .92rem; white-space: nowrap;
}
.app-header__nav a:hover { background: rgba(255,255,255,.12); color: #fff; }
.app-header__nav a.is-active { background: rgba(0,0,0,.15); color: #fff; font-weight: 600; }

.app-header__right {
  margin-left: auto; display: flex; align-items: center; gap: 8px;
}

.cart-link {
  position: relative; color: #fff; font-size: 1.35rem;
  width: 42px; height: 42px; display: grid; place-items: center;
  border-radius: 8px;
}
.cart-link:hover, .cart-link.is-active { background: rgba(0,0,0,.15); }
.cart-badge {
  position: absolute; top: 2px; right: 0;
  background: #fff; color: var(--brand);
  font-size: .68rem; font-weight: 700;
  min-width: 17px; height: 17px; padding: 0 4px;
  border-radius: 9px; display: grid; place-items: center;
}

.btn-logout {
  background: rgba(255,255,255,.15); color: #fff;
  border: 0; border-radius: 8px; padding: 0 12px; min-height: 38px; margin-left: 4px;
  font-family: inherit; font-size: .85rem; cursor: pointer;
  display: flex; align-items: center; gap: 6px;
}
.btn-logout:hover { background: rgba(255,255,255,.25); }
.user-name { display: none; max-width: 120px; overflow: hidden; text-overflow: ellipsis; }

/* แถบล่างสำหรับมือถือ */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
  background: var(--surface); border-top: 1px solid var(--line);
  display: flex; padding-bottom: env(safe-area-inset-bottom);
}
.bottom-nav a {
  flex: 1; padding: 8px 4px; text-align: center; min-height: 56px; justify-content: center;
  color: var(--ink-soft); font-size: .76rem;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.bottom-nav a.is-active { color: var(--brand); font-weight: 600; }
.bottom-nav__icon { font-size: 1.35rem; line-height: 1; position: relative; display: flex; }
.bottom-nav .cart-badge { top: -4px; right: -8px; background: var(--brand); color: #fff; }

/* ---------- cards ---------- */

.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 12px;
}
.card--flush { padding: 0; overflow: hidden; }

/* ---------- แคตตาล็อกแบบ Shopee ---------- */

.search-bar {
  display: flex; gap: 8px; margin-bottom: 14px;
  position: sticky; top: var(--header-h); z-index: 20;
  background: var(--bg); padding: 10px 0;
}
.search-bar__icon {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  color: var(--ink-soft); pointer-events: none; display: flex;
}
.search-bar input {
  flex: 1; padding: 10px 14px 10px 40px; font-size: .95rem;
  border: 1px solid var(--line); border-radius: 20px;
  font-family: inherit; background: var(--surface);
}
.search-bar input:focus { outline: 2px solid var(--brand); border-color: transparent; }

.category-strip {
  display: flex; gap: 8px; overflow-x: auto;
  padding-bottom: 10px; margin-bottom: 14px;
  scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.category-strip::-webkit-scrollbar { display: none; }

.cat-chip {
  flex-shrink: 0; padding: 7px 14px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 18px; font-size: .88rem; cursor: pointer;
  font-family: inherit; color: var(--ink);
  display: flex; align-items: center; gap: 5px;
  white-space: nowrap;
}
.cat-chip.is-active {
  background: var(--brand); border-color: var(--brand);
  color: #fff; font-weight: 600;
}

.item-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.item-card {
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  display: flex; flex-direction: column;
  transition: transform .12s, box-shadow .12s;
}
.item-card:active { transform: scale(.985); }

.item-card__media {
  position: relative;
  aspect-ratio: 1;
  background: #fafafa;
  overflow: hidden;
}
.item-card__media img,
.item-img {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.item-img--ph {
  display: grid; place-items: center;
  color: #c4c8cf; background: #f3f4f6;
}
.item-img--ph .icon { width: 34%; height: 34%; stroke-width: 1.5; }

.item-card__body { padding: 9px 10px 10px; flex: 1; display: flex; flex-direction: column; }

.item-card__name {
  font-size: .93rem; font-weight: 500; line-height: 1.4;
  margin-bottom: 5px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}

.item-card__meta {
  font-size: .82rem; color: var(--ink-soft);
  margin-top: auto; display: flex; align-items: center;
  justify-content: space-between; gap: 6px; flex-wrap: wrap;
}

.item-card__stock { font-weight: 600; }
.item-card__stock--ok { color: var(--ok-ink); }
.item-card__stock--low { color: var(--warn-ink); }
.item-card__stock--out { color: var(--danger-ink); }

.tag-consumable {
  position: absolute; top: 6px; left: 6px;
  background: var(--warn-ink); color: #fff;
  font-size: .75rem; padding: 2px 8px; border-radius: 4px;
  font-weight: 600;
}
.tag-out {
  position: absolute; inset: 0; background: rgba(0,0,0,.5);
  display: grid; place-items: center; color: #fff;
  font-weight: 600; font-size: .9rem;
}

/* ---------- ปุ่ม ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 16px; border: 1px solid transparent;
  border-radius: 8px; font-family: inherit; font-size: .92rem; font-weight: 500;
  cursor: pointer; transition: background .15s, opacity .15s;
  text-align: center;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn--primary { background: var(--brand); color: #fff; }
.btn--primary:hover:not(:disabled) { background: var(--brand-dark); }
.btn--ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.btn--ghost:hover:not(:disabled) { background: #f9fafb; }
.btn--danger { background: var(--danger-ink); color: #fff; }
.btn--danger-outline { background: var(--surface); border-color: #fca5a5; color: var(--danger-ink); }
.btn--danger-outline:hover:not(:disabled) { background: var(--danger-bg); }
.btn--ok { background: var(--ok-ink); color: #fff; }
.btn--block { width: 100%; }
.btn--sm { padding: 7px 12px; font-size: .86rem; min-height: 36px; }
.btn--lg { padding: 13px 20px; font-size: 1rem; }

.btn-add {
  width: 100%; margin-top: 8px; min-height: 40px;
  background: var(--brand); color: #fff; border: 0;
  padding: 8px; border-radius: 8px; font-family: inherit;
  font-size: .9rem; font-weight: 600; cursor: pointer;
}
.btn-add:hover:not(:disabled) { background: var(--brand-dark); }

/* ตัวปรับจำนวนบนการ์ด — แทนปุ่ม "ใส่ตะกร้า" เมื่อของอยู่ในตะกร้าแล้ว */
.card-stepper {
  margin-top: 8px; display: flex; align-items: center;
  border: 1.5px solid var(--brand); border-radius: 8px; overflow: hidden;
}
.card-stepper button {
  width: 40px; height: 38px; border: 0; background: var(--brand-light);
  color: var(--brand); font-size: 1.2rem; font-weight: 700; cursor: pointer;
  font-family: inherit;
}
.card-stepper button:disabled { color: var(--ink-faint); background: #f3f4f6; cursor: not-allowed; }
.card-stepper span { flex: 1; text-align: center; font-size: .86rem; font-weight: 600; color: var(--brand); }
.btn-add:disabled { background: var(--line); color: var(--ink-faint); cursor: not-allowed; }

/* ---------- ตัวปรับจำนวน ---------- */

.qty-control {
  display: inline-flex; align-items: center;
  border: 1px solid var(--line); border-radius: 6px; overflow: hidden;
  background: var(--surface);
}
.qty-control button {
  width: 40px; height: 40px; border: 0; background: #f9fafb;
  font-size: 1.1rem; cursor: pointer; color: var(--ink);
  display: grid; place-items: center; font-family: inherit;
}
.qty-control button:disabled { color: var(--ink-faint); cursor: not-allowed; }
.qty-control input {
  width: 48px; height: 40px; border: 0; text-align: center;
  font-family: inherit; font-size: .92rem;
  border-left: 1px solid var(--line); border-right: 1px solid var(--line);
  -moz-appearance: textfield;
}
.qty-control input::-webkit-outer-spin-button,
.qty-control input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* ---------- ฟอร์ม ---------- */

.field { margin-bottom: 14px; }
.field label {
  display: block; font-size: .87rem; font-weight: 500;
  margin-bottom: 5px; color: var(--ink);
}
.field .hint { font-size: .82rem; color: var(--ink-soft); margin-top: 4px; }
.field .required { color: var(--danger); }

.input, select.input, textarea.input {
  width: 100%; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 8px;
  font-family: inherit; font-size: .95rem; background: var(--surface);
  color: var(--ink);
}
.input:focus { outline: 2px solid var(--brand); border-color: transparent; }
textarea.input { resize: vertical; min-height: 70px; }

.pin-input {
  letter-spacing: .5em; text-align: center;
  font-size: 1.4rem; padding: 12px;
}

/* ---------- badge / chip ---------- */

.badge {
  display: inline-block; padding: 2px 10px;
  border-radius: 11px; font-size: .8rem; font-weight: 600;
  white-space: nowrap;
}
.badge--ok { background: var(--ok-bg); color: #047857; }
.badge--warn { background: var(--warn-bg); color: #b45309; }
.badge--danger { background: var(--danger-bg); color: #b91c1c; }
.badge--info { background: var(--info-bg); color: #1d4ed8; }
.badge--muted { background: #f3f4f6; color: var(--ink-soft); }

/* ---------- รายการยืม ---------- */

.loan-card { background: var(--surface); border-radius: var(--radius);
  box-shadow: var(--shadow); margin-bottom: 12px; overflow: hidden; }
.loan-card__head {
  padding: 12px 14px; border-bottom: 1px solid var(--line);
  display: flex; align-items: flex-start; justify-content: space-between; gap: 10px;
}
.loan-card__id { font-size: .76rem; color: var(--ink-soft); font-family: monospace; }
/* เกินกำหนดคืน — แถบแดงซ้ายการ์ดให้เห็นตั้งแต่ไกล */
.loan-card--overdue { border-left: 4px solid var(--danger-ink); }
.loan-card__hint { font-size: .86rem; color: var(--info-ink); margin-top: 8px; }
.loan-card__body { padding: 12px 14px; }
.loan-card__foot {
  padding: 10px 14px; background: #fafafa; border-top: 1px solid var(--line);
  display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap;
}

.line-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 0; border-bottom: 1px dashed var(--line);
}
.line-item:last-child { border-bottom: 0; }
.line-item__img { width: 42px; height: 42px; border-radius: 6px;
  overflow: hidden; flex-shrink: 0; background: #f3f4f6; }
.line-item__info { flex: 1; min-width: 0; }
.line-item__name { font-size: .9rem; font-weight: 500; }
.line-item__sub { font-size: .82rem; color: var(--ink-soft); }
.line-item__qty { font-size: .88rem; font-weight: 600; white-space: nowrap; }

.due-chip { font-size: .84rem; font-weight: 600; display: inline-flex; align-items: center; gap: 4px; }
.due-chip--ok { color: var(--ok-ink); }
.due-chip--soon { color: var(--warn-ink); }
.due-chip--over { color: var(--danger-ink); }

/* ---------- ตาราง (หน้าครู) ---------- */

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.data {
  width: 100%; border-collapse: collapse; font-size: .88rem;
  background: var(--surface);
}
table.data th, table.data td {
  padding: 9px 11px; text-align: left; border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
table.data th {
  background: #f9fafb; font-weight: 600; font-size: .8rem;
  color: var(--ink-soft); position: sticky; top: 0;
}
table.data tbody tr:hover { background: #fafafa; }
table.data td.wrap { white-space: normal; min-width: 150px; }

/* ---------- สถิติ ---------- */

.stat-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px;
  margin-bottom: 18px;
}
.stat {
  background: var(--surface); border-radius: var(--radius);
  padding: 14px; box-shadow: var(--shadow);
  border-left: 3px solid var(--brand);
}
.stat--danger { border-left-color: var(--danger); }
.stat--warn { border-left-color: var(--warn); }
.stat--ok { border-left-color: var(--ok); }
.stat__value { font-size: 1.7rem; font-weight: 700; line-height: 1.1; }
.stat__label { font-size: .84rem; color: var(--ink-soft); margin-top: 2px; }

/* ---------- ถ่ายรูป ---------- */

.photo-zone {
  border: 2px dashed var(--line); border-radius: var(--radius);
  padding: 28px 16px; text-align: center; cursor: pointer;
  background: var(--surface); transition: border-color .15s, background .15s;
}
.photo-zone:hover { border-color: var(--brand); background: var(--brand-light); }
.photo-zone__icon { font-size: 2.6rem; margin-bottom: 8px; color: var(--brand); display: flex; justify-content: center; }
.photo-zone__hint { font-size: .82rem; color: var(--ink-soft); }
.photo-zone input[type=file] { display: none; }

.photo-preview { position: relative; border-radius: var(--radius); overflow: hidden; }
.photo-preview img { width: 100%; display: block; }
.photo-preview__meta {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: linear-gradient(transparent, rgba(0,0,0,.75));
  color: #fff; padding: 20px 12px 8px; font-size: .78rem;
  display: flex; justify-content: space-between; align-items: center;
}

/* ---------- toast / overlay ---------- */

.toast-host {
  position: fixed; top: 12px; left: 12px; right: 12px; z-index: 200;
  display: flex; flex-direction: column; gap: 8px; align-items: center;
  pointer-events: none;
}
.toast {
  background: var(--ink); color: #fff;
  padding: 11px 18px; border-radius: 8px; font-size: .9rem;
  box-shadow: var(--shadow-lg); max-width: 420px; width: fit-content;
  opacity: 0; transform: translateY(-12px); transition: opacity .25s, transform .25s;
}
.toast.is-visible { opacity: 1; transform: translateY(0); }
.toast--error { background: var(--danger); }
.toast--success { background: var(--ok); }

.loading-overlay {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(255,255,255,.75); backdrop-filter: blur(2px);
  display: none; place-items: center;
}
.loading-overlay.is-visible { display: grid; }
.loading-box { text-align: center; }
.spinner {
  width: 34px; height: 34px; margin: 0 auto 10px;
  border: 3px solid var(--line); border-top-color: var(--brand);
  border-radius: 50%; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.modal-backdrop {
  position: fixed; inset: 0; z-index: 250;
  background: rgba(0,0,0,.45);
  display: none; place-items: center; padding: 20px;
}
.modal-backdrop.is-visible { display: grid; }
.modal {
  background: var(--surface); border-radius: 12px;
  padding: 22px; max-width: 400px; width: 100%;
  box-shadow: var(--shadow-lg);
}
.modal__message { margin-bottom: 18px; }
.modal__actions { display: flex; gap: 8px; justify-content: flex-end; }

/* ---------- misc ---------- */

.empty-state { text-align: center; padding: 44px 20px; color: var(--ink-soft); }
.empty-state__icon { font-size: 3rem; margin-bottom: 10px; opacity: .55; }

/* ---------- หน้ายืมอุปกรณ์: สถานะของฉัน + ขั้นตอน ---------- */

.status-banner {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border-radius: var(--radius); margin-bottom: 12px;
  border: 1px solid; font-size: .92rem;
}
.status-banner > .icon { width: 1.4em; height: 1.4em; }
.status-banner__text { flex: 1; min-width: 0; }
.status-banner__text small { display: block; font-size: .84rem; }
.status-banner__text a { color: inherit; text-decoration: underline; }
.status-banner .btn { white-space: nowrap; }
.status-banner--danger { background: var(--danger-bg); border-color: #fca5a5; color: var(--danger-ink); }
.status-banner--ok { background: var(--ok-bg); border-color: #6ee7b7; color: var(--ok-ink); }
.status-banner--info { background: var(--info-bg); border-color: #93c5fd; color: var(--info-ink); }

.steps {
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 12px 14px; margin-bottom: 12px; position: relative;
}
.steps__title { font-weight: 600; font-size: .92rem; margin-bottom: 8px; padding-right: 36px; }
.steps__list {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px 12px;
  margin: 0; padding: 0; list-style: none; counter-reset: step;
}
.steps__list li { display: flex; align-items: center; gap: 8px; font-size: .86rem; counter-increment: step; }
.steps__list li::before {
  content: counter(step); flex-shrink: 0;
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--brand-light); color: var(--brand);
  display: grid; place-items: center; font-weight: 700; font-size: .8rem;
}
.steps__close {
  position: absolute; top: 6px; right: 6px; width: 36px; height: 36px;
  border: 0; background: none; color: var(--ink-soft); cursor: pointer;
  border-radius: 6px; display: grid; place-items: center; font-size: 1.1rem;
}
.steps__close:hover { background: #f3f4f6; }

.alert {
  padding: 11px 14px; border-radius: 8px; font-size: .88rem;
  margin-bottom: 14px; border-left: 3px solid;
}
.alert--info { background: var(--info-bg); border-color: var(--info); color: #1e40af; }
.alert--warn { background: var(--warn-bg); border-color: var(--warn); color: #92400e; }
.alert--danger { background: var(--danger-bg); border-color: var(--danger); color: #991b1b; }
.alert--ok { background: var(--ok-bg); border-color: var(--ok); color: #065f46; }

.sticky-bar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 60;
  background: var(--surface); border-top: 1px solid var(--line);
  padding: 10px 14px; padding-bottom: calc(10px + env(safe-area-inset-bottom));
  box-shadow: 0 -2px 10px rgba(0,0,0,.08);
  display: flex; align-items: center; gap: 12px;
}
.sticky-bar__info { flex: 1; font-size: .88rem; }

/* แถบส่งคำขอที่ลอยเหนือแถบเมนูล่าง (มือถือ) — บนจอใหญ่ไม่มีแถบเมนูล่าง จึงชิดขอบล่าง */
.sticky-bar--nav {
  bottom: calc(56px + env(safe-area-inset-bottom));
  padding-bottom: 10px;
}
.sticky-bar--nav .btn { white-space: nowrap; }
.page.page--has-bar { padding-bottom: 150px; }

@keyframes bump { 0% { transform: scale(1); } 40% { transform: scale(1.08); } 100% { transform: scale(1); } }
.is-bump { animation: bump .35s ease; }

.text-muted { color: var(--ink-soft); }
.text-sm { font-size: .86rem; }
.text-center { text-align: center; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 14px; }
.mb-0 { margin-bottom: 0; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.flex-gap { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ---------- desktop ---------- */

@media (min-width: 640px) {
  body { font-size: 15px; }
  .item-grid { grid-template-columns: repeat(3, 1fr); gap: 14px; }
  .stat-grid { grid-template-columns: repeat(4, 1fr); }
  .user-name { display: inline; }
  .page { padding: 20px; padding-bottom: 40px; }
  .steps__list { grid-template-columns: repeat(4, 1fr); }
}

@media (min-width: 900px) {
  .app-header__nav { display: flex; }
  .bottom-nav { display: none; }
  .item-grid { grid-template-columns: repeat(4, 1fr); }
  .page { padding-bottom: 40px; }
  .sticky-bar--nav { bottom: 0; padding-bottom: calc(10px + env(safe-area-inset-bottom)); }
  .sticky-bar--nav { padding-left: max(14px, calc((100% - 1100px) / 2)); padding-right: max(14px, calc((100% - 1100px) / 2)); }
  .page.page--has-bar { padding-bottom: 100px; }
  h1 { font-size: 1.55rem; }
}

@media (min-width: 1100px) {
  .item-grid { grid-template-columns: repeat(5, 1fr); }
}

@media print {
  .app-header, .bottom-nav, .sticky-bar, .btn, .no-print { display: none !important; }
  body { background: #fff; }
  .card { box-shadow: none; border: 1px solid var(--line); }
}

/* โลโก้หน้าเข้าสู่ระบบ/สมัคร */
.brand-mark {
  width: 64px; height: 64px; margin: 0 auto 12px; border-radius: 18px;
  background: var(--brand); color: #fff; font-size: 1.9rem;
  display: grid; place-items: center; box-shadow: var(--shadow-lg);
}
