/* ===== App shell (Client back-office + Officer) — TopHeader + side-bar components ===== */
:root {
  --side-bg: #2b3d5c;          /* States/inverse-hover */
  --side-open: #3e4f6b;
  --side-deep: #0e2346;
  --text-muted: #5b6785;       /* Functional/text-muted */
  --error-red: #c0182b;        /* Functional/error-red */
  --page-bg: #f5f7fa;
}

body.app { background: var(--page-bg); min-height: 100vh; font-family: var(--font-ui); }

/* ---------- Top header ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  height: 64px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 32px; background: var(--white);
  border-bottom: 1px solid #e6e9ef;
}
.topbar .logo img { width: 65px; height: 50px; object-fit: cover; }
.topbar .right { display: flex; align-items: center; gap: 16px; }
.topbar .noti { position: relative; width: 36px; height: 36px; background: none; border: 0; padding: 0; }
.topbar .noti img { position: absolute; left: 0; top: -1px; width: 36px; height: 37px; max-width: none; }
.topbar .who { text-align: right; font-family: var(--font-th); }
.topbar .who .name { font-weight: 600; font-size: 13px; color: #1c2740; margin-bottom: -1px; }
.topbar .who .role { font-weight: 500; font-size: 11px; line-height: 14.3px; color: #6b7686; }
.topbar .user-menu { width: 24px; height: 24px; background: none; border: 0; padding: 0; }
.topbar .user-menu img { width: 24px; height: 24px; }

/* Client variant of TopHeader: company name only, Noto Serif */
body[data-side="client"] .topbar .who { padding: 10px; }
body[data-side="client"] .topbar .who .name { font: 400 16px var(--font-serif); color: var(--navy-900); margin: 0; }
.topbar .who .role:empty { display: none; }

/* ---------- Layout ---------- */
.shell { display: flex; align-items: stretch; min-height: calc(100vh - 64px); }
.main { flex: 1 1 0; min-width: 0; }

/* ---------- Side bar ---------- */
.sidebar { flex-shrink: 0; background: var(--side-deep); width: 260px; }
.sidebar .inner { background: var(--side-bg); min-height: 826px; padding: 24px 0; box-shadow: 0 0 2.5px rgba(0,0,0,.15); position: sticky; top: 64px; }
.sidebar.collapsed { width: 44px; }
.sidebar.collapsed .inner { overflow: hidden; width: 44px; }

.menu { display: block; }
.menu-head, .menu-item {
  display: flex; align-items: center; gap: 8px;
  width: 260px; padding: 8px 12px; border: 0; text-align: left;
  background: var(--side-bg); color: var(--white);
  font: 400 14px/normal var(--font-ui);
}
.menu-head:hover, .menu-item:hover { background: #34486a; }
.menu-item { padding-left: 44px; }               /* 12 + 24 icon + 8 gap */
.menu-item.active, .menu-head.active { font-weight: 600; }
.sidebar.collapsed .menu-head.active { background: var(--side-open); }
.menu-head .label, .menu-item .label { flex: 1 1 0; min-width: 0; min-height: 19px; display: flex; align-items: center; }
.menu .subs { display: none; }
.menu.open .menu-head { background: var(--side-open); }
.menu.open .subs { display: block; }
.menu .caret { width: 24px; height: 24px; transition: transform .15s; }
.menu.open .caret { transform: rotate(180deg); }
.sidebar.collapsed .menu .subs { display: none; }
.sidebar.collapsed a.menu-head, .sidebar.collapsed button.menu-head { width: 44px; overflow: hidden; }

/* icon boxes — geometry copied from the icon-set component */
.ico { position: relative; width: 24px; height: 24px; flex-shrink: 0; }
.ico img { position: absolute; max-width: none; }
.ico.doc img      { left: 3px;   top: 1px; width: 18px; height: 22px; }  /* คำขอ / คำร้อง */
.ico.search img   { left: 2px;   top: 2px; width: 20px; height: 20px; }  /* กระบวนการไต่สวน */
.ico.book img     { left: 2.5px; top: 3px; width: 19px; height: 18px; }  /* คู่มือการใช้งาน */

/* ---------- Generic UI used on several app pages ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 16px; border-radius: 6px; border: 1px solid transparent;
  font: 500 14px var(--font-ui); white-space: nowrap;
}
.btn-primary { background: var(--navy-900); color: var(--white); }
.btn-primary:hover { background: #1b3561; }
.btn-outline { background: var(--white); color: var(--navy-900); border-color: #cfd5df; }
.btn-outline:hover { background: #f2f5f9; }
.btn-danger { background: var(--error-red); color: var(--white); }
.card { background: var(--white); border: 1px solid #e4e7ec; border-radius: 8px; }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font-size: 12px; white-space: nowrap; }

/* modal */
.modal-backdrop { position: fixed; inset: 0; background: rgba(14, 35, 70, .45); display: flex; align-items: center; justify-content: center; z-index: 60; }
.modal-backdrop[hidden] { display: none; }
