/* ─── DESIGN TOKENS ─── */
:root {
  --primary: #1a365d;
  --primary-light: #2b6cb0;
  --primary-dark: #0f2440;
  --success: #2f855a;
  --danger: #c53030;
  --warning: #d69e2e;
  --bg: #f0f4f8;
  --surface: #ffffff;
  --text: #1a202c;
  --text-muted: #718096;
  --border: #e2e8f0;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
  --radius: 6px;
  --radius-lg: 10px;
  --transition: 0.2s ease;
  /* Typography */
  --font-sans: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-serif: 'Times New Roman', Georgia, Cambria, serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  --lh-tight: 1.2;
  --lh-body: 1.5;
  --lh-loose: 1.7;
}

/* ─── BADGES ─── */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.badge-admin { background: #e8f5e9; color: var(--primary); }
.badge-employee { background: #e8f5e9; color: var(--primary); }

/* ─── MAIN CONTENT LAYOUT ─── */
.main-content {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.main-content-inner {
  flex: 1;
  width: 100%;
}

/* ─── MANAGEMENT HEADER ─── */
.management-header {
  background: #1e3a8a;
  padding: 14px 28px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  box-shadow: 0 2px 12px rgba(30,58,138,0.25);
}

.mh-left {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1;
  min-width: 0;
}

.mh-title {
  font-size: 15px;
  font-weight: 600;
  color: #ffffff;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mh-meta {
  font-size: 12px;
  color: rgba(255,255,255,0.65);
  font-weight: 400;
  white-space: nowrap;
}

.mh-right {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
}

/* ─── ROLE BADGE ─── */
.mh-role-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 14px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  border: 1.5px solid;
}

.mh-role-employee {
  background: rgba(255,255,255,0.1);
  color: #93c5fd;
  border-color: rgba(147,197,253,0.3);
}

.mh-role-admin {
  background: rgba(251,191,36,0.12);
  color: #fbbf24;
  border-color: rgba(251,191,36,0.3);
}

/* ─── GHOST ACTION BUTTONS ─── */
.mh-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.mh-actions button,
.mh-actions a,
.mh-nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 16px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 500;
  font-family: inherit;
  line-height: var(--lh-body);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.15);
  color: #e0e7ff;
  transition: all 0.15s ease;
}

.mh-actions button:hover,
.mh-actions a:hover,
.mh-nav-btn:hover {
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.35);
  color: #ffffff;
}

/* Save button — solid blue */
.mh-actions .btn-save {
  background: #2563eb;
  border-color: #2563eb;
  color: #ffffff;
  font-weight: 600;
}

.mh-actions .btn-save:hover {
  background: #1d4ed8;
  border-color: #1d4ed8;
}

/* Print button — solid amber */
.mh-actions .btn-print {
  background: #d97706;
  border-color: #d97706;
  color: #ffffff;
  font-weight: 600;
}

.mh-actions .btn-print:hover {
  background: #b45309;
  border-color: #b45309;
}

/* Navigation button — slightly brighter for wayfinding */
.mh-actions .mh-nav-btn {
  font-weight: 600;
  border-color: rgba(255,255,255,0.3);
}
.mh-actions .mh-nav-btn:hover {
  background: rgba(255,255,255,0.15);
  border-color: rgba(255,255,255,0.5);
}

/* ─── TOAST NOTIFICATIONS ─── */
#toastContainer {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 99999;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  background: #ffffff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  border-radius: 8px;
  min-width: 260px;
  max-width: 400px;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 400;
  line-height: 1.4;
  color: #1e293b;
  font-family: var(--font-sans);
  animation: toastFadeIn 0.2s ease forwards;
  border-top: 2px solid #2563eb;
}

.toast.toast-out { animation: toastFadeOut 0.2s ease forwards; }

@keyframes toastFadeIn {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes toastFadeOut {
  to { opacity: 0; transform: translateY(-4px); }
}

/* ─── LOADING OVERLAY ─── */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(26, 32, 44, 0.5);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99998;
  animation: fadeIn 0.15s ease;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid rgba(255,255,255,0.2);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.loading-overlay .loading-text {
  color: #fff;
  font-size: 15px;
  margin-left: 14px;
  font-weight: 500;
}

/* ─── ADMIN TABS ─── */
.admin-tabs {
    padding: 16px 20px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    gap: 6px;
    background: #f8fafc;
}
.admin-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 18px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: #64748b;
    background: transparent;
    text-decoration: none;
    transition: background 0.15s, color 0.15s, box-shadow 0.15s;
    line-height: 1.4;
}
.admin-tab svg {
    flex-shrink: 0;
    opacity: 0.7;
    transition: opacity 0.15s;
}
.admin-tab:hover {
    background: #e2e8f0;
    color: #1e293b;
}
.admin-tab:hover svg { opacity: 1; }
.admin-tab.active {
    background: #1e3a8a;
    color: white;
    box-shadow: 0 1px 3px rgba(30,58,138,0.2);
}
.admin-tab.active svg { opacity: 1; }

/* ─── TOOLBAR ─── */
.toolbar {
    display: flex; align-items: center; gap: 6px;
    padding: 10px 16px;
    background: #fafbfc;
    border-bottom: 1px solid #e2e8f0;
    border-radius: 8px 8px 0 0;
}
.toolbar .toolbar-spacer { flex: 1; }
.toolbar-btn {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 7px 16px;
    border: none; border-radius: 6px;
    cursor: pointer; font-family: inherit;
    font-size: 13px; font-weight: 500;
    color: #475569; background: transparent;
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
    line-height: 1.4;
}
.toolbar-btn:hover { background: #e2e8f0; color: #1e293b; }
.toolbar-btn-primary {
    background: #1e3a8a; color: #fff;
}
.toolbar-btn-primary:hover { background: #152c6b; color: #fff; }
.toolbar-btn-danger {
    color: #dc2626;
}
.toolbar-btn-danger:hover { background: #fef2f2; color: #b91c1c; }

/* ─── RESPONSIVE ─── */
@media (max-width: 768px) {
  .management-header { padding: 12px 16px; gap: 10px; }
  .mh-title { font-size: 13px; }
  .mh-right { gap: 8px; }
  .mh-actions button,
  .mh-actions a,
  .mh-actions .btn-action,
  .mh-actions .btn-tool { padding: 6px 12px; font-size: 11px; }
  .mh-meta { display: none; }
}

/* ─── PRINT ─── */
@media print {
  @page { size: A4; margin: 12mm 15mm; }

  .management-header,
  .sidebar, .sidebar-toggle, .no-print,
  #toastContainer, .loading-overlay,
  .mh-actions, .mh-nav-btn, .mh-role-badge,
  .drawer-overlay, .side-drawer,
  .admin-tabs, .admin-tab,
  .toolbar, .toolbar-btn {
    display: none !important;
  }

  body { background: white; -webkit-print-color-adjust: exact; print-color-adjust: exact; }

  .main-content-inner {
    padding: 0 !important;
    max-width: none !important;
  }

  .main-content { margin-left: 0 !important; }

  tr { page-break-inside: avoid; }
  thead { display: table-header-group; }
  tfoot { display: table-footer-group; }
}
