/* Bo cuc man hinh nhan vien: sidebar + noi dung. Mau sac lay tu bien trong theme.css / themes.css. */
.shell { display: grid; grid-template-columns: 250px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  background: var(--sidebar-bg); color: var(--sidebar-ink); padding: 16px 12px;
  display: flex; flex-direction: column; gap: 6px; position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 14px; color: var(--sidebar-ink); text-decoration: none; }
.brand:hover { text-decoration: none; }
.brand svg { width: 44px; height: 44px; flex: none; }
.brand .org-logo { width: 44px; height: 44px; object-fit: contain; flex: none; }
.brand b { font-size: 18px; line-height: 1.1; display: block; }
.brand span { font-size: 11px; opacity: .85; font-weight: 700; }
.nav-group { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; opacity: .7; padding: 12px 10px 4px; font-weight: 800; }
.side-nav a {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 12px; color: var(--sidebar-ink);
  font-weight: 700; text-decoration: none; position: relative;
}
.side-nav a .ico { width: 22px; text-align: center; font-size: 17px; flex: none; }
.side-nav a:hover { background: var(--sidebar-hover); }
.side-nav a.active { background: var(--sidebar-active-bg); color: var(--sidebar-active-ink); box-shadow: 0 4px 12px rgba(0, 0, 0, .15); }
.side-nav a .count {
  margin-left: auto; background: var(--danger); color: #fff; border-radius: 999px; font-size: 11px;
  padding: 1px 7px; font-weight: 800; animation: pulse 1.2s ease-in-out infinite;
}
.sidebar-foot { margin-top: auto; padding: 10px 8px 0; font-size: 12px; opacity: .85; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 12px; padding: 12px 22px; background: var(--topbar-bg);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 50;
}
.topbar h1 { font-size: 20px; }
.topbar .spacer { flex: 1; }
.topbar .form-select { min-height: 36px; padding: 5px 10px; width: auto; max-width: 220px; }
.user-chip { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 13px; }
.user-chip small { display: block; font-weight: 600; color: var(--muted); font-size: 11px; }
.menu-btn { display: none; }
.content { padding: 20px 22px 40px; display: flex; flex-direction: column; gap: 16px; }

.lang-toggle { display: inline-flex; border-radius: 999px; background: var(--soft); padding: 3px; }
.lang-toggle button { border: 0; background: transparent; padding: 4px 10px; border-radius: 999px; font-weight: 800; cursor: pointer; font-size: 12px; color: var(--ink); }
.lang-toggle button.active { background: var(--card); color: var(--ocean-deep); box-shadow: 0 1px 4px rgba(0,0,0,.12); }

.global-alert {
  display: flex; gap: 10px; align-items: center; background: var(--danger); color: #fff; padding: 12px 16px;
  border-radius: 14px; font-weight: 800; text-decoration: none;
}
.global-alert:hover { text-decoration: none; filter: brightness(1.05); }

/* KPI cards */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; }
.kpi {
  border-radius: var(--radius); padding: 16px; color: var(--navy); background: var(--card); box-shadow: var(--shadow);
  position: relative; overflow: hidden; border: 1px solid var(--card-border);
}
.kpi::after { content: ""; position: absolute; right: -18px; top: -18px; width: 80px; height: 80px; border-radius: 50%; background: var(--tone, var(--soft)); opacity: .55; }
.kpi.t-green { --tone: var(--t-green-bg); } .kpi.t-blue { --tone: var(--t-blue-bg); } .kpi.t-coral { --tone: var(--t-coral-bg); }
.kpi.t-sun { --tone: var(--t-sun-bg); } .kpi.t-aqua { --tone: var(--t-aqua-bg); } .kpi.t-red { --tone: var(--t-red-bg); }
.kpi .ico { font-size: 24px; position: relative; z-index: 1; }
.kpi .val { font-size: 28px; font-weight: 900; line-height: 1.1; margin-top: 6px; position: relative; z-index: 1; }
.kpi .val small { font-size: 14px; font-weight: 800; color: var(--muted); }
.kpi .lbl { font-size: 12px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin-top: 2px; }
.kpi .sub { font-size: 12px; color: var(--muted); margin-top: 4px; }

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }

/* Charts */
.chart { width: 100%; height: 240px; display: block; }
.chart text { font-family: var(--font); fill: var(--muted); font-size: 11px; font-weight: 700; }
.chart .grid-line { stroke: var(--line); stroke-width: 1; }
.chart .bar { transition: opacity .15s; }
.chart .bar:hover { opacity: .8; }
.chart .dot { fill: var(--card); }
.hbars { display: flex; flex-direction: column; gap: 10px; }
.hbar .top { display: flex; justify-content: space-between; gap: 10px; font-weight: 800; font-size: 13px; margin-bottom: 4px; }
.hbar .track { height: 14px; background: var(--soft); border-radius: 999px; overflow: hidden; }
.hbar .fill { height: 100%; border-radius: 999px; background: var(--c-bar-grad); min-width: 4px; transition: width .5s ease; }
.chart-tip {
  position: fixed; z-index: 800; pointer-events: none; background: #123B5C; color: #fff; padding: 6px 10px;
  border-radius: 10px; font-size: 12px; font-weight: 800; transform: translate(-50%, -120%); white-space: nowrap;
}

/* Leaderboard rows (staff) */
.lb-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 14px; background: var(--row); }
.lb-row + .lb-row { margin-top: 8px; }
.lb-row .rank { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-weight: 900; background: var(--card); color: var(--ocean-dark); flex: none; box-shadow: inset 0 0 0 2px var(--line); }
.lb-row.top1 { background: linear-gradient(90deg, var(--t-sun-bg), var(--row)); }
.lb-row.top2 { background: linear-gradient(90deg, var(--t-gray-bg), var(--row)); }
.lb-row.top3 { background: linear-gradient(90deg, var(--t-sim-bg), var(--row)); }
.lb-row .rank.medal { background: transparent; box-shadow: none; font-size: 26px; }
.lb-row .who { flex: 1; min-width: 0; }
.lb-row .who b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb-row .score { text-align: right; font-weight: 900; white-space: nowrap; }
.lb-row .score small { display: block; font-weight: 700; color: var(--muted); font-size: 11px; }

/* Floor map (security + floors) */
.floor-map { display: grid; gap: 5px; background: var(--t-blue-bg); padding: 10px; border-radius: 16px; }
.floor-map .tile { aspect-ratio: 1; border-radius: 8px; background: var(--card); min-width: 18px; display: grid; place-items: center; font-size: 10px; color: var(--muted); font-weight: 800; }
.floor-map .tile.hot { background: var(--danger); animation: blink .6s steps(2) infinite; }
@keyframes blink { 50% { opacity: .35; } }

/* Danh sach dang the (yeu cau doi qua, canh bao) */
.list-row { background: var(--row); border-radius: 16px; padding: 10px 14px; }
.alert-card { border-left: 8px solid var(--danger); background: var(--t-red-bg); box-shadow: none; }
.alert-card.ack { border-left-color: var(--sun-deep); }
.report-type { text-align: left; border: 3px solid transparent; cursor: pointer; }
.report-type.active { border-color: var(--ocean); }

/* Login / landing */
.landing { min-height: 100vh; display: grid; grid-template-columns: 1.1fr .9fr; }
.landing .hero {
  background: var(--hero-bg, linear-gradient(170deg, #BDEBFF 0%, #5CCBF7 45%, #0288D1 100%)); color: var(--hero-ink, var(--navy));
  padding: 40px; display: flex; flex-direction: column; justify-content: center; gap: 20px; position: relative; overflow: hidden;
}
.landing .hero h1 { color: var(--hero-ink, var(--navy)); font-size: clamp(30px, 4vw, 46px); text-shadow: var(--hero-title-shadow, 0 3px 0 rgba(255,255,255,.6)); }
.landing .hero p { font-size: 17px; max-width: 520px; font-weight: 600; }
.landing .hero .mascot { width: min(300px, 60%); }
.landing .panel { padding: 40px; display: flex; flex-direction: column; justify-content: center; gap: 18px; background: var(--card); }
.flow { display: flex; flex-wrap: wrap; gap: 8px; }
.flow span { background: var(--hero-chip, rgba(255,255,255,.85)); color: var(--navy); border-radius: 999px; padding: 6px 12px; font-weight: 800; font-size: 13px; }
.quick-links { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.quick-links a {
  background: var(--soft); border-radius: 16px; padding: 14px 10px; text-align: center; font-weight: 800;
  color: var(--navy); text-decoration: none; transition: transform .15s;
}
.quick-links a:hover { transform: translateY(-3px); }
.quick-links a { display: flex; flex-direction: column; align-items: center; gap: 8px; }

@media (max-width: 1100px) {
  .shell { grid-template-columns: 72px minmax(0, 1fr); }
  .sidebar { padding: 12px 8px; }
  .brand b, .brand span, .side-nav a .txt, .nav-group, .sidebar-foot { display: none; }
  .side-nav a { justify-content: center; padding: 11px 6px; }
  .side-nav a .count { position: absolute; top: 2px; right: 2px; }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; width: 260px; z-index: 200; transform: translateX(-105%);
    transition: transform .2s ease; box-shadow: var(--shadow-lg);
  }
  .shell.nav-open .sidebar { transform: none; }
  .shell.nav-open::after { content: ""; position: fixed; inset: 0; background: var(--overlay); z-index: 150; }
  .brand b, .brand span, .nav-group, .sidebar-foot { display: block; }
  .side-nav a .txt { display: inline; }
  .side-nav a { justify-content: flex-start; padding: 9px 10px; }
  .side-nav a .count { position: static; }
  .menu-btn { display: inline-grid; }
  .topbar { padding: 10px 14px; gap: 8px; flex-wrap: wrap; }
  .topbar h1 { font-size: 17px; }
  .user-chip .name { display: none; }
  .content { padding: 14px 14px 30px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .landing { grid-template-columns: 1fr; }
  .landing .hero { padding: 28px 22px; }
  .landing .hero .mascot { width: 150px; }
  .landing .panel { padding: 24px 20px; }
}

/* ---- Icon trong menu, logo, nguoi dung ---- */
.side-nav a .ico .i { font-size: 17px; }
.brand .brand-mark { width: 44px; height: 44px; }
.brand .wordmark small { color: inherit; }
.user-avatar { width: 34px; height: 34px; font-size: 15px; font-weight: 900; color: var(--on-primary); background: var(--btn-primary) !important; }
.empty-art { display: grid; place-items: center; margin-bottom: 10px; }
.kpi .ico-tile { position: relative; z-index: 1; }
.kpi-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; position: relative; z-index: 1; }
.global-alert .i { font-size: 20px; }

/* Thanh dieu huong duoi day (chi hien tren dien thoai) */
.bottom-nav { display: none; }
@media (max-width: 760px) {
  .bottom-nav {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 120;
    background: var(--card); border-top: 1px solid var(--line); box-shadow: 0 -6px 20px rgba(0, 0, 0, .08);
    padding: 6px 4px calc(6px + var(--safe-b));
  }
  .bottom-nav a, .bottom-nav button {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 6px 2px; border: 0;
    background: transparent; color: var(--muted); font-size: 10.5px; font-weight: 800; text-decoration: none; border-radius: 12px;
    position: relative; cursor: pointer; min-height: 52px;
  }
  .bottom-nav a span, .bottom-nav button span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  .bottom-nav .i { font-size: 19px; }
  .bottom-nav a.active { color: var(--ocean-deep); background: var(--soft); }
  .bottom-nav .count { position: absolute; top: 2px; right: calc(50% - 22px); margin: 0; }
  .content { padding-bottom: calc(86px + var(--safe-b)); }
  .topbar { padding-top: calc(10px + var(--safe-t)); flex-wrap: nowrap; }
  .topbar h1 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 1 1 auto; }
  .topbar .spacer { display: none; }
  .topbar > .pill, .topbar .lang-toggle { display: none; }
  .topbar .form-select { max-width: 120px; }
  .logout-btn .txt { display: none; }
  .logout-btn { padding: 6px 9px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { padding: 12px; }
  .kpi .val { font-size: 22px; }
  .card { padding: 14px; border-radius: calc(var(--radius) - 2px); }
  .filters label.field { min-width: calc(50% - 6px); flex: 1 1 calc(50% - 6px); }
  .nav-pills { width: 100%; overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; }
  .nav-pills::-webkit-scrollbar { display: none; }
  .nav-pills .nav-link { white-space: nowrap; }
  .card-head > .line { width: 100%; }
  .card-head > .line .form-control { flex: 1 1 auto; max-width: none !important; }
  .toast-container { bottom: calc(76px + var(--safe-b)) !important; left: 0; right: 0; }
  html[data-theme="fpt"] .bottom-nav a.active { color: var(--fpt-orange); }
}
@media (max-width: 380px) {
  .kpi .lbl { font-size: 10.5px; }
}

/* Bo loc thu gon duoc (mo san tren may tinh, dong san tren dien thoai) */
.filter-box > summary { display: flex; align-items: center; gap: 10px; cursor: pointer; list-style: none; margin: -2px 0; }
.filter-box > summary::-webkit-details-marker { display: none; }
.filter-box > summary .chev { transition: transform .2s; color: var(--muted); }
.filter-box[open] > summary { margin-bottom: 14px; }
.filter-box[open] > summary .chev { transform: rotate(90deg); }

.brand-org { flex-direction: column; align-items: stretch; gap: 10px; padding: 4px 4px 14px; }
.brand-org .logo-card { padding: 4px 0; }
.brand-org .org-logo { width: 100%; height: auto !important; max-height: 72px; }
.brand-sub { display: flex; align-items: center; gap: 8px; padding: 0 4px; }
.brand-sub .brand-mark { width: 26px; height: 26px; }
.brand-sub .wordmark b { font-size: 14px; }
.user-chip .dropdown-toggle::after { display: none; }
#hero-logo .logo-card { width: fit-content; }
#hero-logo .org-logo { height: 72px; }
@media (max-width: 1100px) and (min-width: 761px) {
  .brand-org .logo-card { padding: 4px; }
  .brand-org .org-logo { max-height: 40px; }
  .brand-sub { display: none; }
}

.logout-btn { white-space: nowrap; }
@media (max-width: 1100px) and (min-width: 761px) {
  .brand-org { padding: 2px 0 12px; }
  .brand-org .logo-card { display: flex; padding: 4px; border-radius: 10px; }
}

.cam-log { max-height: 260px; overflow: auto; white-space: pre-wrap; font-size: 12px; margin: 0; }
.cam-steps { margin: 0; padding-left: 20px; display: grid; gap: 8px; }
.cam-stage { position: relative; width: 100%; max-height: 70vh; aspect-ratio: 16 / 9; background: var(--bs-dark, #000); border-radius: 12px; overflow: hidden; }
.cam-stage.mirror .cam-video, .cam-stage.mirror .cam-canvas { transform: scaleX(-1); }
.cam-video, .cam-canvas { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.cam-canvas { cursor: crosshair; touch-action: manipulation; }
.cam-hint { position: absolute; left: 8px; right: 8px; top: 8px; padding: 8px 12px; border-radius: 8px; background: var(--bs-body-bg); color: var(--bs-body-color); font-weight: 600; text-align: center; }
.cam-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.cam-stat { display: flex; flex-direction: column; align-items: center; padding: 8px; border-radius: 10px; background: var(--bs-tertiary-bg); }
.cam-stat b { font-size: 1.6rem; line-height: 1.1; }
.cam-stat span { font-size: .8rem; color: var(--bs-secondary-color); text-align: center; }
@media (max-width: 640px) { .cam-stats { grid-template-columns: repeat(2, 1fr); } .cam-stage { aspect-ratio: 3 / 4; } }

.bulk-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 8px 12px; margin-bottom: 10px;
  border-radius: 12px; background: var(--table-head); }
.table .check-col { width: 36px; }
.table .form-check-input { width: 1.2em; height: 1.2em; cursor: pointer; }
@media (max-width: 640px) {
  .table td.check-col { justify-content: flex-start; padding-bottom: 0; }
  .table td.check-col::before { display: none; }
}
