/* ============================================================
   Layout — Admin shell & Mobile shell
   ============================================================ */

/* ================= ADMIN SHELL ================= */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: 86px; flex: none; background: #241C56;
  color: #dfe1f4; display: flex; flex-direction: column;
  position: fixed; inset: 0 auto 0 0; z-index: 60;
  transition: transform .25s ease;
}
.sidebar-brand {
  padding: 1rem .5rem .9rem; display: grid; place-items: center;
  border-bottom: 1px solid rgba(255,255,255,.12);
}
.sidebar-brand .logo-badge {
  width: 40px; height: 40px; border-radius: 11px; background: #fff;
  display: grid; place-items: center; flex: none; box-shadow: 0 2px 6px rgba(0,0,0,.15);
}
.sidebar-brand .logo-badge img { width: 30px; height: auto; }
.sidebar-brand b { color: #fff; font-size: .98rem; line-height: 1.1; letter-spacing: -.01em; }
.sidebar-brand span { font-size: .68rem; color: #b9bbe6; letter-spacing: .04em; }

.sidebar-nav { flex: 1; overflow-y: auto; padding: .7rem .5rem 2rem; }
.sidebar-nav::-webkit-scrollbar { width: 6px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.18); border-radius: 3px; }
.nav-group-label { font-size: .66rem; text-transform: uppercase; letter-spacing: .12em; color: #9698d4; padding: .9rem .7rem .35rem; font-weight: 700; }
.nav-item {
  display: grid; justify-items: center; gap: .22rem; padding: .62rem .2rem .55rem; border-radius: 10px;
  color: #A9A6D0; text-decoration: none; margin-bottom: .25rem;
  transition: background .13s, color .13s; position: relative;
}
.nav-item svg { width: 21px; height: 21px; flex: none; }
.nav-item .ni-t { font-size: .6rem; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; line-height: 1; }
.nav-item:hover { background: rgba(255,255,255,.1); color: #fff; text-decoration: none; }
.nav-item.active { background: var(--rr-red); color: #fff; }
.nav-item .nav-badge { margin-left: auto; background: var(--rr-red); color: #fff; font-size: .66rem; font-weight: 700; padding: .1rem .4rem; border-radius: 10px; }

.main { flex: 1; margin-left: 86px; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: 60px; background: rgba(255,255,255,.9); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 1rem; padding: 0 1.4rem;
}
.topbar .hamburger { display: none; background: none; border: none; cursor: pointer; color: var(--ink-2); padding: .3rem; }
.crumb { font-size: .85rem; color: var(--muted); display: flex; align-items: center; gap: .4rem; }
.crumb b { color: var(--ink); font-weight: 600; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: .5rem; }

.iconbtn { position: relative; background: none; border: 1px solid transparent; width: 38px; height: 38px; border-radius: 10px; cursor: pointer; color: var(--ink-2); display: grid; place-items: center; }
.iconbtn:hover { background: var(--bg-2); }
.iconbtn svg { width: 20px; height: 20px; }
.iconbtn .count { position: absolute; top: 5px; right: 5px; min-width: 16px; height: 16px; padding: 0 3px; background: var(--rr-red); color: #fff; font-size: .62rem; font-weight: 700; border-radius: 10px; display: grid; place-items: center; }

.user-chip { display: flex; align-items: center; gap: .55rem; padding: .3rem .5rem .3rem .3rem; border-radius: 22px; border: 1px solid var(--line); background: #fff; cursor: pointer; }
.user-chip:hover { background: var(--bg-2); }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--rr-blue); color: #fff; display: grid; place-items: center; font-size: .8rem; font-weight: 700; flex: none; }
.avatar.lg { width: 54px; height: 54px; font-size: 1.2rem; }
.user-chip .u-name { font-size: .82rem; font-weight: 600; line-height: 1; }
.user-chip .u-role { font-size: .68rem; color: var(--muted); }

.dropdown { position: relative; }
.dropdown-menu {
  position: absolute; right: 0; top: calc(100% + 8px); background: #fff; border: 1px solid var(--line);
  border-radius: var(--r); box-shadow: var(--shadow-lg); min-width: 220px; padding: .4rem; z-index: 80; display: none;
}
.dropdown.open .dropdown-menu { display: block; animation: fadeIn .14s; }
.dropdown-menu a, .dropdown-menu button {
  display: flex; align-items: center; gap: .6rem; width: 100%; text-align: left; padding: .55rem .7rem;
  border-radius: 8px; font-size: .87rem; color: var(--ink-2); background: none; border: none; cursor: pointer; text-decoration: none;
}
.dropdown-menu a:hover, .dropdown-menu button:hover { background: var(--bg-2); text-decoration: none; }
.dropdown-menu svg { width: 17px; height: 17px; opacity: .8; }
.dropdown-menu .sep { height: 1px; background: var(--line-2); margin: .3rem 0; }
.dropdown-menu .danger { color: var(--danger); }

.notif-panel {
  position: absolute; right: 0; top: calc(100% + 8px); width: 340px; max-width: 92vw; background: #fff;
  border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-lg); z-index: 80; display: none; overflow: hidden;
}
.dropdown.open .notif-panel { display: block; animation: fadeIn .14s; }
.notif-panel .np-head { padding: .8rem 1rem; border-bottom: 1px solid var(--line-2); display: flex; justify-content: space-between; align-items: center; }
.notif-list { max-height: 380px; overflow-y: auto; }
.notif-row { padding: .75rem 1rem; border-bottom: 1px solid var(--line-2); display: flex; gap: .7rem; text-decoration: none; color: inherit; }
.notif-row:hover { background: var(--bg-2); text-decoration: none; }
.notif-row.unread { background: var(--rr-blue-050); }
.notif-row .nr-ic { width: 32px; height: 32px; border-radius: 9px; flex: none; display: grid; place-items: center; background: var(--bg-2); }
.notif-row .nr-title { font-size: .84rem; font-weight: 600; }
.notif-row .nr-body { font-size: .78rem; color: var(--muted); }
.notif-row .nr-time { font-size: .7rem; color: #9aa4b5; margin-top: .1rem; }

.content { padding: 0 0 3rem; flex: 1; }
.content > *:not(.page-band):not(.page-head) { margin-left: 1.6rem; margin-right: 1.6rem; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.3rem; flex-wrap: wrap; }
.page-head .ph-title h1 { margin: 0; }
.page-head .ph-title p { margin: .2rem 0 0; color: var(--muted); font-size: .88rem; }
.page-actions { display: flex; gap: .5rem; flex-wrap: wrap; }

.filters { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; margin-bottom: 1rem; }
.filters .input, .filters .select { width: auto; min-width: 150px; }
.filters .search { flex: 1; min-width: 200px; max-width: 360px; }

.sidebar-scrim { display: none; position: fixed; inset: 0; background: rgba(10,14,30,.5); z-index: 55; }

@media (max-width: 960px) {
  .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
  .content > *:not(.page-band):not(.page-head) { margin-left: 1rem; margin-right: 1rem; }
  .sidebar.open { transform: translateX(0); }
  .sidebar.open ~ .sidebar-scrim { display: block; }
  .main { margin-left: 0; }
  .topbar .hamburger { display: grid; place-items: center; }
  .user-chip .u-meta { display: none; }
}

/* ================= MOBILE SHELL ================= */
.m-app { max-width: 520px; margin: 0 auto; min-height: 100vh; background: var(--bg); display: flex; flex-direction: column; position: relative; padding-bottom: 74px; }
.m-top {
  position: sticky; top: 0; z-index: 30; background: var(--rr-blue); color: #fff;
  padding: .85rem 1rem; display: flex; align-items: center; gap: .7rem;
  box-shadow: 0 2px 10px rgba(46,45,130,.25);
}
.m-top .m-back { background: rgba(255,255,255,.15); border: none; color: #fff; width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; cursor: pointer; }
.m-top h1 { font-size: 1.05rem; margin: 0; color: #fff; font-weight: 600; flex: 1; }
.m-top .m-top-act { color: #fff; }
.m-logo-badge { width: 32px; height: 32px; border-radius: 9px; background: #fff; display: grid; place-items: center; flex: none; }
.m-logo-badge img { width: 24px; height: auto; }

.m-body { padding: 1rem; flex: 1; }

.m-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 40; max-width: 520px; margin: 0 auto;
  background: #fff; border-top: 1px solid var(--line); display: flex; padding: .3rem .2rem calc(.3rem + env(safe-area-inset-bottom));
  box-shadow: 0 -4px 20px rgba(20,28,50,.06);
}
.m-nav a {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: .12rem; padding: .45rem 0;
  color: var(--muted); font-size: .66rem; font-weight: 600; text-decoration: none; border-radius: 10px;
}
.m-nav a svg { width: 22px; height: 22px; }
.m-nav a.active { color: var(--rr-blue); }
.m-nav .m-fab {
  flex: none; width: 56px; margin-top: -22px; align-self: flex-start;
}
.m-nav .m-fab .fab-ic {
  width: 52px; height: 52px; border-radius: 50%; background: var(--rr-red); color: #fff;
  display: grid; place-items: center; box-shadow: 0 6px 16px rgba(236,28,36,.4); margin: 0 auto 2px;
}
.m-nav .m-fab svg { width: 26px; height: 26px; }

.m-stat { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: .9rem; box-shadow: var(--shadow-sm); }
.m-stat .v { font-size: 1.5rem; font-weight: 800; color: var(--ink); font-variant-numeric: tabular-nums; }
.m-stat .l { font-size: .72rem; color: var(--muted); font-weight: 600; }

.m-list-item { display: flex; align-items: center; gap: .8rem; padding: .85rem; background: #fff; border: 1px solid var(--line); border-radius: var(--r); margin-bottom: .55rem; text-decoration: none; color: inherit; }
.m-list-item:hover { border-color: #d6dcea; text-decoration: none; }
.m-list-item .mli-ic { width: 40px; height: 40px; border-radius: 10px; background: var(--rr-blue-050); color: var(--rr-blue); display: grid; place-items: center; flex: none; }
.m-list-item .mli-main { flex: 1; min-width: 0; }
.m-list-item .mli-title { font-weight: 600; font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-list-item .mli-sub { font-size: .77rem; color: var(--muted); }

/* Login pages */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 1.2rem; background:
  radial-gradient(1100px 500px at 15% -10%, rgba(46,45,130,.14), transparent 60%),
  radial-gradient(900px 500px at 110% 10%, rgba(236,28,36,.10), transparent 55%), var(--bg); }
.auth-card { width: 100%; max-width: 400px; background: #fff; border-radius: var(--r-xl); box-shadow: var(--shadow-lg); overflow: hidden; border: 1px solid var(--line); }
.auth-head { padding: 2rem 2rem 1rem; text-align: center; }
.auth-head .logo-badge { width: 62px; height: 62px; border-radius: 16px; background: #fff; box-shadow: var(--shadow); display: grid; place-items: center; margin: 0 auto 1rem; border: 1px solid var(--line-2); }
.auth-head .logo-badge img { width: 48px; height: 48px; }
.auth-head h1 { font-size: 1.3rem; }
.auth-head p { color: var(--muted); font-size: .88rem; margin: 0; }
.auth-body { padding: .5rem 2rem 2rem; }
.auth-foot { padding: 1rem 2rem; background: #fafbfe; border-top: 1px solid var(--line-2); text-align: center; font-size: .8rem; color: var(--muted); }
