/* IT Helpdesk V15 — Foundation, application shell, navigation and login */
[hidden], .hidden, .permission-hidden { display: none !important; }

*, *::before, *::after { box-sizing: border-box; }
html { min-height: 100%; scroll-behavior: smooth; }
body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--ui-text);
  background:
    radial-gradient(circle at 88% -10%, rgba(37, 99, 235, .06), transparent 30%),
    var(--ui-canvas);
  font-family: "Plus Jakarta Sans", Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
body.hd-modal-open { overflow: hidden; }
a { color: var(--ui-brand); text-decoration: none; }
a:hover { color: var(--ui-brand-hover); }
button, input, select, textarea { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
button:disabled, [aria-disabled="true"] { cursor: not-allowed; opacity: .56; }
::selection { color: #fff; background: var(--ui-brand); }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { border: 2px solid transparent; border-radius: 999px; background: rgba(71, 85, 105, .28); background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(71, 85, 105, .44); background-clip: padding-box; }

:where(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: 2px solid transparent;
  box-shadow: var(--ui-focus);
}

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 3000;
  padding: 10px 14px;
  border-radius: var(--ui-radius-sm);
  color: #fff;
  background: var(--ui-navy);
  box-shadow: var(--ui-shadow-md);
  transform: translateY(-160%);
  transition: transform var(--ui-transition);
}
.skip-link:focus { transform: translateY(0); }

/* LOGIN */
.login-page {
  position: relative;
  z-index: 10;
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 28px;
  overflow: hidden;
  background:
    radial-gradient(circle at 14% 10%, rgba(229, 85, 47, .28), transparent 26%),
    radial-gradient(circle at 88% 86%, rgba(37, 99, 235, .22), transparent 32%),
    linear-gradient(145deg, #111827 0%, #0b1220 52%, #18243a 100%);
}
.login-page::before,
.login-page::after {
  content: "";
  position: absolute;
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 50%;
  pointer-events: none;
}
.login-page::before { width: 540px; height: 540px; top: -290px; right: -170px; }
.login-page::after { width: 420px; height: 420px; bottom: -240px; left: -120px; }
.login-card {
  position: relative;
  width: min(100%, 440px);
  padding: 38px;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 26px;
  background: rgba(255,255,255,.96);
  box-shadow: 0 34px 90px rgba(0,0,0,.30);
  backdrop-filter: blur(22px);
  animation: ui-login-enter .45s var(--ui-ease) both;
}
@keyframes ui-login-enter { from { opacity: 0; transform: translateY(18px) scale(.985); } }
.login-logo { margin-bottom: 28px; text-align: center; }
.login-logo .logo-fallback,
.login-logo .logo-img-wrap {
  display: grid;
  width: 76px;
  height: 76px;
  margin: 0 auto 18px;
  overflow: hidden;
  place-items: center;
  border: 1px solid rgba(229,85,47,.20);
  border-radius: 22px;
  color: #fff;
  background: linear-gradient(145deg, var(--ui-brand), #ff8a5c);
  box-shadow: 0 16px 30px rgba(229,85,47,.24);
}
.login-logo .logo-fallback i { font-size: 27px; }
.login-logo .logo-img-wrap img { width: 100%; height: 100%; object-fit: contain; }
.login-logo h2 { margin: 0; color: var(--ui-text-strong); font-family: "Space Grotesk", sans-serif; font-size: 24px; letter-spacing: -.03em; }
.login-logo p { margin: 6px 0 0; color: var(--ui-text-muted); font-size: 13px; }
.login-page .form-group label { color: var(--ui-text-soft); }
.login-page .form-control { color: var(--ui-text); background: #fff; border-color: var(--ui-border); }
.login-page .form-control::placeholder { color: #a3adbb; }
.login-page .pw-toggle { color: var(--ui-text-muted); }
.login-hint { color: var(--ui-text-muted) !important; }

/* APPLICATION SHELL */
.app-layout { display: flex; min-height: 100vh; }
.sidebar-overlay { display: none; }
.sidebar {
  position: fixed;
  inset: 12px auto 12px 12px;
  z-index: 650;
  display: flex;
  width: calc(var(--ui-sidebar-w) - 12px);
  min-width: 0;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 24px;
  color: rgba(255,255,255,.78);
  background:
    radial-gradient(circle at 10% 0%, rgba(229,85,47,.20), transparent 24%),
    linear-gradient(180deg, #131d2d 0%, #0d1626 54%, #0a1220 100%);
  box-shadow: 0 26px 70px rgba(15,23,42,.18);
  transition: width 220ms var(--ui-ease), transform 220ms var(--ui-ease), box-shadow 220ms var(--ui-ease);
}
.sidebar-header {
  display: flex;
  min-height: 78px;
  align-items: center;
  gap: 12px;
  padding: 15px 16px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-logo {
  display: grid;
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  overflow: hidden;
  place-items: center;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 15px;
  color: #fff;
  background: linear-gradient(145deg, var(--ui-brand), #f5825d);
  box-shadow: 0 12px 22px rgba(229,85,47,.22);
}
.sidebar-logo img { width: 100%; height: 100%; object-fit: contain; }
.sidebar-logo i { font-size: 18px; }
.sidebar-brand { min-width: 0; }
.sidebar-brand h3 { margin: 0; overflow: hidden; color: #fff; font-family: "Space Grotesk", sans-serif; font-size: 15px; font-weight: 700; letter-spacing: -.01em; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-brand p { margin: 3px 0 0; color: rgba(255,255,255,.42); font-size: 9px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
.sidebar-nav {
  flex: 1 1 auto;
  min-height: 0;
  padding: 10px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.nav-section { margin: 0 0 8px; }
.nav-section-title {
  padding: 10px 12px 6px;
  color: rgba(255,255,255,.32);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
}
.nav-item {
  position: relative;
  display: flex;
  width: 100%;
  min-height: 44px;
  align-items: center;
  gap: 11px;
  margin: 2px 0;
  padding: 6px 10px;
  border: 0;
  border-radius: 12px;
  color: rgba(255,255,255,.66);
  background: transparent;
  font-size: 12.5px;
  font-weight: 650;
  line-height: 1.2;
  text-align: left;
  cursor: pointer;
  transition: color var(--ui-transition), background var(--ui-transition), transform var(--ui-transition);
}
.nav-item:hover { color: #fff; background: rgba(255,255,255,.07); }
.nav-item:active { transform: translateY(1px); }
.nav-item.active {
  color: #fff;
  background: linear-gradient(90deg, rgba(229,85,47,.22), rgba(255,255,255,.08));
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.06);
}
.nav-item.active::before {
  content: "";
  position: absolute;
  left: 0;
  width: 3px;
  height: 22px;
  border-radius: 0 4px 4px 0;
  background: #ff8b65;
  box-shadow: 0 0 16px rgba(255,139,101,.55);
}
.nav-icon,
.nav-item > i {
  display: inline-grid;
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  place-items: center;
  border-radius: 9px;
  color: rgba(255,255,255,.58);
  background: rgba(255,255,255,.045);
  font-size: 13px;
  transition: color var(--ui-transition), background var(--ui-transition);
}
.nav-icon i { font-size: 13px; }
.nav-item:hover .nav-icon,
.nav-item:hover > i,
.nav-item.active .nav-icon,
.nav-item.active > i { color: #fff; background: rgba(255,255,255,.09); }
.nav-item > span:not(.nav-icon):not(.nav-badge) { min-width: 0; flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-badge {
  display: inline-flex;
  min-width: 22px;
  height: 22px;
  align-items: center;
  justify-content: center;
  margin-left: auto;
  padding: 0 7px;
  border-radius: var(--ui-radius-pill);
  color: #fff;
  background: var(--ui-brand);
  font-size: 10px;
  font-weight: 800;
}
.sidebar-footer { padding: 10px; border-top: 1px solid rgba(255,255,255,.08); }
.sidebar-account { display: flex; align-items: center; gap: 6px; }
.sidebar-user {
  display: flex;
  min-width: 0;
  flex: 1 1 auto;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border: 0;
  border-radius: 14px;
  color: #fff;
  background: rgba(255,255,255,.045);
  text-align: left;
  cursor: pointer;
  transition: background var(--ui-transition);
}
.sidebar-user:hover { background: rgba(255,255,255,.08); }
.sidebar-user .avatar {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  place-items: center;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 12px;
  color: #101828;
  background: linear-gradient(145deg, #ffd5c5, #fff0c2);
  font-size: 13px;
  font-weight: 800;
}
.sidebar-user .user-info { min-width: 0; flex: 1 1 auto; }
.sidebar-user .user-name,
.sidebar-user .user-role { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user .user-name { color: #fff; font-size: 12px; font-weight: 750; }
.sidebar-user .user-role { margin-top: 2px; color: rgba(255,255,255,.40); font-size: 9.5px; }
.sidebar-logout {
  display: inline-grid;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  place-items: center;
  border: 0;
  border-radius: 12px;
  color: rgba(255,255,255,.48);
  background: transparent;
  cursor: pointer;
  transition: color var(--ui-transition), background var(--ui-transition);
}
.sidebar-logout:hover { color: #fff; background: rgba(220,38,38,.22); }

.main-content {
  width: calc(100% - var(--ui-sidebar-w));
  min-width: 0;
  min-height: 100vh;
  margin-left: var(--ui-sidebar-w);
  transition: width 220ms var(--ui-ease), margin-left 220ms var(--ui-ease);
}
.main-header {
  position: sticky;
  top: 0;
  z-index: 500;
  display: flex;
  min-height: var(--ui-header-h);
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 10px 24px;
  border-bottom: 1px solid rgba(226,232,240,.90);
  background: rgba(243,246,250,.88);
  backdrop-filter: blur(18px);
}
.header-left, .header-right { display: flex; align-items: center; }
.header-left { min-width: 0; gap: 12px; }
.header-right { gap: 8px; }
.menu-toggle,
.header-btn,
.header-logout-btn {
  border: 1px solid var(--ui-border);
  color: var(--ui-text-soft);
  background: rgba(255,255,255,.82);
  box-shadow: var(--ui-shadow-xs);
  cursor: pointer;
  transition: color var(--ui-transition), border-color var(--ui-transition), background var(--ui-transition), transform var(--ui-transition), box-shadow var(--ui-transition);
}
.menu-toggle,
.header-btn { display: inline-grid; width: 42px; height: 42px; place-items: center; border-radius: 12px; }
.menu-toggle:hover,
.header-btn:hover { color: var(--ui-brand); border-color: #f3c2b3; background: #fff; box-shadow: var(--ui-shadow-sm); transform: translateY(-1px); }
.page-title { overflow: hidden; color: var(--ui-text-strong); font-family: "Space Grotesk", sans-serif; font-size: 18px; font-weight: 700; letter-spacing: -.025em; text-overflow: ellipsis; white-space: nowrap; }
.header-logout-btn { display: inline-flex; min-height: 42px; align-items: center; gap: 8px; padding: 0 14px; border-radius: 12px; font-size: 12px; font-weight: 700; }
.header-logout-btn:hover { color: var(--ui-danger); border-color: #fecaca; background: #fff; }
.notif-dot { position: absolute; top: 9px; right: 9px; width: 7px; height: 7px; border: 2px solid #fff; border-radius: 50%; background: var(--ui-danger); }
.header-btn { position: relative; }
.main-body { width: min(100%, var(--ui-content-max)); margin-inline: auto; padding: 24px; }

/* DESKTOP COLLAPSED SIDEBAR */
@media (min-width: 769px) {
  body.desktop-sidebar-collapsed .sidebar { width: calc(var(--ui-sidebar-collapsed-w) - 12px); }
  body.desktop-sidebar-collapsed .main-content { width: calc(100% - var(--ui-sidebar-collapsed-w)); margin-left: var(--ui-sidebar-collapsed-w); }
  body.desktop-sidebar-collapsed .sidebar-header { justify-content: center; padding-inline: 10px; }
  body.desktop-sidebar-collapsed .sidebar-brand,
  body.desktop-sidebar-collapsed .nav-section-title,
  body.desktop-sidebar-collapsed .nav-item > span:not(.nav-icon),
  body.desktop-sidebar-collapsed .sidebar-user .user-info,
  body.desktop-sidebar-collapsed .sidebar-logout { display: none; }
  body.desktop-sidebar-collapsed .sidebar-nav { padding-inline: 8px; }
  body.desktop-sidebar-collapsed .nav-section { margin-bottom: 2px; }
  body.desktop-sidebar-collapsed .nav-item { justify-content: center; width: 52px; min-height: 50px; margin: 3px auto; padding: 0; }
  body.desktop-sidebar-collapsed .nav-item::after {
    content: attr(data-tooltip);
    position: fixed;
    left: 84px;
    z-index: 1200;
    max-width: 220px;
    padding: 8px 10px;
    border-radius: 9px;
    color: #fff;
    background: #111827;
    box-shadow: var(--ui-shadow-md);
    font-size: 11px;
    opacity: 0;
    pointer-events: none;
    transform: translateX(-4px);
    transition: opacity var(--ui-transition), transform var(--ui-transition);
  }
  body.desktop-sidebar-collapsed .nav-item:hover::after { opacity: 1; transform: translateX(0); }
  body.desktop-sidebar-collapsed .sidebar-user { justify-content: center; padding: 6px; }
}

/* Department shell */
.dept-page { min-height: 100vh; max-width: 1120px; margin: 0 auto; padding: 28px 20px 50px; }
.dept-header { padding: 28px; border: 1px solid var(--ui-border); border-radius: var(--ui-radius-xl); background: linear-gradient(145deg, #fff, #fbfcfe); box-shadow: var(--ui-shadow-sm); text-align: center; }
.dept-header .dept-logo-fallback,
.dept-header .dept-logo { display: grid; width: 72px; height: 72px; margin: 0 auto 14px; overflow: hidden; place-items: center; border-radius: 20px; color: #fff; background: linear-gradient(145deg, var(--ui-brand), #f58a67); box-shadow: 0 14px 28px rgba(229,85,47,.22); }
.dept-header .dept-logo img { width: 100%; height: 100%; object-fit: contain; }
.dept-header h1 { margin: 0; font-family: "Space Grotesk", sans-serif; font-size: 24px; }
.dept-header p { margin: 5px 0 0; color: var(--ui-text-muted); }
.dept-user-bar { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin: 16px 0; padding: 12px 14px; border: 1px solid var(--ui-border); border-radius: var(--ui-radius-lg); background: #fff; box-shadow: var(--ui-shadow-xs); }
.dept-user-info { display: flex; align-items: center; gap: 10px; }
.dept-avatar { display: grid; width: 38px; height: 38px; place-items: center; border-radius: 12px; color: #fff; background: var(--ui-navy); font-weight: 800; }

/* Maintenance public scan shell */
.maint-page { display: grid; min-height: 100vh; place-items: center; padding: 24px; background: linear-gradient(145deg, #0f172a, #17243a); }
.maint-card { width: min(100%, 680px); border: 1px solid rgba(255,255,255,.12); border-radius: 26px; background: rgba(255,255,255,.96); box-shadow: 0 30px 90px rgba(0,0,0,.35); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
