/* Admin shell: sidebar + topbar + tables + modal + permission editor. */

.admin-shell { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.side { background: #fff; border-right: 1px solid var(--line); padding: 14px 12px; }
.side .sbrand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 14px; border-bottom: 1px solid var(--line); margin-bottom: 10px; }
.side .sbrand .t { font-family: 'Baloo Da 2', sans-serif; font-weight: 700; font-size: 13.5px; line-height: 1.1; }
.side .sbrand .s { font-size: 10.5px; color: var(--muted); }
.sgroup { font-size: 10.5px; text-transform: uppercase; letter-spacing: .6px; color: var(--faint); font-weight: 600; padding: 12px 10px 5px; }
.sitem { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 9px; font-size: 13.5px; color: #4a3e37; cursor: pointer; font-weight: 500; border: 0; background: none; width: 100%; text-align: left; font-family: inherit; }
.sitem:hover { background: #F7F2EA; }
.sitem.on { background: var(--primary); color: #fff; }
.sitem .ic { width: 17px; height: 17px; flex: 0 0 auto; }
.sitem.hidden { display: none; }

.main { padding: 22px 26px; max-width: 1120px; }
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; gap: 12px; }
.topbar .r { display: flex; align-items: center; gap: 12px; }
.who { display: flex; align-items: center; gap: 9px; }
.who .avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); display: flex; align-items: center; justify-content: center; font-family: 'Baloo Da 2', sans-serif; font-weight: 700; }
.who .n { font-size: 13px; font-weight: 600; }
.who .role { font-size: 11px; color: var(--primary); font-weight: 600; }

.page-head { margin-bottom: 18px; }
.page-head h1 { font-size: 24px; }
.page-head p { margin: 4px 0 0; color: var(--muted); font-size: 13.5px; }

.panel { background: #fff; border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); overflow: hidden; }
.panel .hd { padding: 14px 18px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.panel .hd h3 { font-size: 15px; }
.panel .bd { padding: 16px 18px; }
.cols-side { display: grid; grid-template-columns: 320px 1fr; gap: 18px; align-items: start; }

.field { margin-bottom: 12px; }
.field label { font-size: 12.5px; font-weight: 600; color: var(--muted); display: block; margin-bottom: 5px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

table.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--faint); font-weight: 600; padding: 11px 16px; border-bottom: 1px solid var(--line); }
.tbl td { padding: 12px 16px; border-bottom: 1px solid #F3ECE0; font-size: 13.5px; vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl .vn { font-weight: 600; }
.mono { font-family: 'Baloo Da 2', sans-serif; }
.acts { display: flex; gap: 7px; justify-content: flex-end; }
.ic-btn { width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--line); background: #fff; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; color: #5b5049; }
.ic-btn:hover { background: #F7F2EA; }
.ic-btn.danger:hover { background: #FBEAE8; color: var(--red); border-color: #E7C4C0; }
.perms-chips { display: flex; gap: 5px; flex-wrap: wrap; }
.pchip { font-size: 10.5px; font-weight: 600; padding: 2px 8px; border-radius: 6px; background: var(--gold-soft); color: var(--amber); }
.pchip.view { background: #F1EADF; color: #8a7c6c; }
.toolbar { display: flex; align-items: center; justify-content: space-between; padding: 13px 18px; border-bottom: 1px solid var(--line); }
.toolbar .l { font-size: 13px; color: var(--muted); }
.toolbar .l b { color: var(--ink); font-family: 'Baloo Da 2', sans-serif; }
.empty { padding: 26px; text-align: center; color: var(--muted); font-size: 13.5px; }

/* Modal */
.modal-back { position: fixed; inset: 0; background: rgba(40,26,20,.45); display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; z-index: 60; overflow-y: auto; }
.modal { background: #fff; border-radius: 18px; box-shadow: 0 20px 60px rgba(40,26,20,.25); width: 100%; max-width: 520px; }
.modal .hd { padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; }
.modal .hd h2 { font-size: 18px; }
.modal .bd { padding: 18px 20px; }
.modal .ft { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; }
.close-x { width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--line); background: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center; color: var(--muted); }

.roleopt { display: flex; gap: 8px; }
.ro { flex: 1; border: 1.5px solid var(--line); border-radius: 10px; padding: 10px; text-align: center; font-weight: 600; font-size: 13px; cursor: pointer; color: var(--muted); }
.ro.on { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
.perm-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 14px; }
.perm-row { display: flex; align-items: center; gap: 9px; padding: 7px 0; }
.perm-row input { width: 17px; height: 17px; accent-color: var(--primary); }
.perm-row label { font-size: 13.5px; }
.presets { display: flex; gap: 8px; flex-wrap: wrap; margin: 6px 0 12px; }
.section-label { font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--faint); font-weight: 600; margin: 14px 0 8px; }
.note { display: flex; gap: 8px; align-items: flex-start; background: #F1F5FB; border: 1px solid #DCE6F3; border-radius: 10px; padding: 10px 12px; margin-top: 12px; font-size: 11.5px; color: #4a5a72; line-height: 1.5; }

@media (max-width: 820px) {
  .admin-shell { grid-template-columns: 1fr; }
  .side { border-right: 0; border-bottom: 1px solid var(--line); }
  .cols-side, .grid-2, .perm-grid { grid-template-columns: 1fr; }
  .main { padding: 16px 14px; }
  .topbar { flex-wrap: wrap; }
  /* Let wide data tables scroll horizontally instead of breaking the layout. */
  table.tbl { display: block; overflow-x: auto; white-space: nowrap; -webkit-overflow-scrolling: touch; }
  .modal-back { padding: 24px 12px; }
}
