/* Shared admin dashboard shell — sidebar + top bar, wraps every admin page's existing content. */
.mt-shell-body {
  display: flex !important;
  align-items: stretch;
  min-height: 100vh;
  padding: 0 !important;
}

.mt-shell-sidebar {
  position: sticky;
  top: 0;
  align-self: flex-start;
  height: 100vh;
  width: 232px;
  flex-shrink: 0;
  background: var(--mt-surface);
  border-right: 1px solid var(--mt-border);
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
  box-sizing: border-box;
  z-index: 500;
  font-family: 'Plus Jakarta Sans', 'Sarabun', sans-serif;
  transition: transform 0.3s ease;
}

.mt-shell-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px 20px;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--mt-border);
}
.mt-shell-brand img { width: 34px; height: 34px; object-fit: contain; flex-shrink: 0; }
.mt-shell-brand span { font-weight: 800; font-size: 1.05rem; color: var(--mt-text); letter-spacing: -0.3px; }
.mt-shell-brand span b { color: var(--mt-primary); }
.mt-shell-version {
  font-size: 1em; font-weight: 800; color: var(--mt-primary); opacity: 0.6; margin-left: 4px; flex-shrink: 0;
}

.mt-shell-nav { display: flex; flex-direction: column; gap: 4px; flex: 1; overflow-y: auto; }
.mt-shell-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: 14px;
  color: var(--mt-text-muted);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.mt-shell-link i { font-size: 1.05rem; width: 20px; text-align: center; flex-shrink: 0; }
.mt-shell-link:hover { background: var(--mt-row-hover); color: var(--mt-text); }
.mt-shell-link.active { background: var(--mt-primary-soft); color: var(--mt-primary); }

.mt-shell-footer { border-top: 1px solid var(--mt-border); padding-top: 10px; margin-top: 10px; }
.mt-shell-footer .mt-shell-link:hover { background: var(--mt-red-soft); color: var(--mt-red); }

.mt-shell-main {
  flex: 1;
  min-width: 0;
  overflow-x: hidden;
  padding: 24px;
  box-sizing: border-box;
  max-width: 1400px;
  margin: 0 auto;
}

/* Every admin page invented its own width/centering scheme for its content
   (.main-content, .header-container, .tab-container — each with a different
   max-width, margin, and padding), so the same table ends up sitting at a
   different horizontal inset from page to page. Make .mt-shell-main above the
   single source of truth for width + centering, and neutralize each page's
   own conflicting container so every admin page lines up on the same edges. */
.mt-shell-main .main-content,
.mt-shell-main .header-container {
  max-width: none !important;
  width: auto !important;
  margin: 0 0 20px !important;
  padding: 0 !important;
}
.mt-shell-main .tab-container {
  margin: 0 0 24px !important;
}

/* The sidebar already covers navigation — hide each page's own redundant
   "Dashboard" button so there's a single, consistent nav story. */
.mt-shell-body .btn-dashboard { display: none !important; }
/* index.html's own top bar (logo/brand) and admin-switch toggle are replaced
   by the shared sidebar once it wraps the page. */
.mt-shell-body .top-bar,
.mt-shell-body .admin-toggle-container { display: none !important; }

.mt-shell-topbar {
  display: none;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--mt-surface);
  border-bottom: 1px solid var(--mt-border);
  position: sticky;
  top: 0;
  z-index: 600;
}
.mt-shell-hamburger {
  width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--mt-border);
  background: var(--mt-surface-2, transparent); color: var(--mt-text); display: flex;
  align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0;
}
.mt-shell-topbar img { width: 26px; height: 26px; object-fit: contain; }
.mt-shell-topbar span { font-weight: 800; color: var(--mt-text); }

/* Desktop top bar: search + notification/mail/profile cluster */
.mt-shell-topbar-desktop {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: -24px -24px 24px;
  padding: 14px 24px;
  background: var(--mt-surface);
  border-bottom: 1px solid var(--mt-border);
  position: sticky;
  top: 0;
  z-index: 500;
}
.mt-shell-search {
  flex: 1;
  max-width: 340px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--mt-row-hover);
  border: 1px solid var(--mt-border);
  border-radius: 12px;
  padding: 9px 14px;
  color: var(--mt-text-muted);
}
.mt-shell-search i { font-size: 0.95rem; }
.mt-shell-search input {
  background: transparent; border: none; outline: none; color: var(--mt-text);
  font-size: 0.88rem; width: 100%; font-family: inherit;
}
.mt-shell-search input::placeholder { color: var(--mt-text-muted); }
.mt-shell-topbar-spacer { flex: 1; }
.mt-shell-icon-btn {
  position: relative;
  width: 38px; height: 38px; border-radius: 12px;
  border: 1px solid var(--mt-border); background: var(--mt-row-hover);
  color: var(--mt-text-muted); display: flex; align-items: center; justify-content: center;
  cursor: pointer; flex-shrink: 0; font-size: 1rem; transition: 0.15s;
}
.mt-shell-icon-btn:hover { color: var(--mt-primary); border-color: var(--mt-primary); }
.mt-shell-icon-btn.mt-spin { color: var(--mt-primary); border-color: var(--mt-primary); pointer-events: none; }
.mt-shell-icon-btn.mt-spin i { animation: mtSpin 0.8s linear infinite; }
@keyframes mtSpin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
.mt-shell-icon-btn .dot {
  position: absolute; top: 7px; right: 8px; width: 7px; height: 7px; border-radius: 50%;
  background: var(--mt-red); border: 2px solid var(--mt-surface);
}

.mt-shell-notif-wrap { position: relative; }
.mt-shell-notif-panel {
  position: absolute; top: calc(100% + 10px); right: 0; width: 300px;
  background: var(--mt-surface); border: 1px solid var(--mt-border); border-radius: 16px;
  box-shadow: 0 16px 36px rgba(0,0,0,0.16); padding: 8px; z-index: 600;
}
.mt-shell-notif-item {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 12px; border-radius: 10px; cursor: pointer; font-size: 0.85rem; color: var(--mt-text);
}
.mt-shell-notif-item:hover { background: var(--mt-row-hover); }
.mt-shell-notif-count {
  background: var(--mt-primary-soft); color: var(--mt-primary); font-weight: 800;
  border-radius: 999px; padding: 2px 9px; font-size: 0.78rem; flex-shrink: 0;
}
.mt-shell-notif-empty, .mt-shell-notif-loading {
  padding: 16px 12px; text-align: center; color: var(--mt-text-muted); font-size: 0.85rem; font-weight: 600;
}

/* Employee sidebar footer variant — anchored above the bell (near the bottom
   of the screen) and left-aligned instead of right-aligned under a topbar icon. */
.mt-shell-notif-panel.notif-panel-up {
  top: auto; left: 0; right: auto; bottom: calc(100% + 8px);
  width: 260px; max-height: 320px; overflow-y: auto;
}
.notif-panel-up .mt-shell-notif-item { flex-direction: column; align-items: flex-start; gap: 2px; }
.mt-shell-profile-chip {
  display: flex; align-items: center; gap: 10px;
  padding: 5px 14px 5px 6px; border-radius: 100px;
  background: var(--mt-row-hover); border: 1px solid var(--mt-border);
  flex-shrink: 0;
}
.mt-shell-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: linear-gradient(135deg, var(--mt-primary), var(--mt-primary-strong));
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 800; font-size: 0.78rem; flex-shrink: 0;
}
.mt-shell-profile-chip span { font-weight: 700; font-size: 0.85rem; color: var(--mt-text); white-space: nowrap; }

@media (max-width: 900px) {
  .mt-shell-topbar-desktop { display: none; }
}

/* Printing a report page shouldn't waste paper on the sidebar/topbar chrome —
   hide the shell entirely so the page's own content can use the full sheet,
   giving tables that spilled onto a second page room to fit on one. */
@media print {
  .mt-shell-sidebar,
  .mt-shell-topbar,
  .mt-shell-topbar-desktop,
  .mt-shell-overlay {
    display: none !important;
  }
  .mt-shell-main {
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
  }
}

.mt-shell-overlay {
  display: none;
  position: fixed; inset: 0; background: rgba(0,0,0,0.45);
  z-index: 490;
}

@media (max-width: 900px) {
  .mt-shell-sidebar {
    position: fixed;
    left: 0; top: 0;
    transform: translateX(-100%);
    box-shadow: 0 0 40px rgba(0,0,0,0.3);
  }
  .mt-shell-sidebar.open { transform: translateX(0); }
  .mt-shell-overlay.open { display: block; }
  .mt-shell-topbar { display: flex; }
  .mt-shell-main { padding: 16px; }
}
