/* App Shell & Responsive Layout */
#app {
  display: flex;
  min-height: 100vh;
  width: 100%;
  position: relative;
}

/* Full Width Auth Viewport */
.auth-page-container {
  width: 100vw;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: radial-gradient(circle at 10% 20%, #1e293b 0%, #0f172a 90%);
  position: relative;
  overflow-y: auto;
}

/* Sidebar (Desktop) */
.app-sidebar {
  width: var(--sidebar-width);
  background: var(--bg-card);
  border-right: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 40;
  transition: transform var(--transition-normal);
}

.sidebar-header {
  height: var(--header-height);
  padding: 0 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border-bottom: 1px solid var(--border-light);
}

.sidebar-logo {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  border: 1px solid var(--border-light);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  padding: 2px;
  flex-shrink: 0;
  overflow: hidden;
}

.sidebar-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.sidebar-brand {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.01em;
}

.sidebar-brand span {
  color: var(--primary);
}

.sidebar-nav {
  padding: 1.25rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex: 1;
  overflow-y: auto;
}

.nav-category {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-subtle);
  padding: 0.75rem 0.75rem 0.25rem;
  letter-spacing: 0.05em;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.92rem;
  transition: all var(--transition-fast);
  cursor: pointer;
  position: relative;
  white-space: nowrap;
}

.nav-item > span:not(.nav-badge):not(.nav-item-icon) {
  white-space: nowrap;
}

.nav-item:hover {
  color: var(--primary);
  background: var(--primary-light);
}

.nav-item.active {
  color: var(--primary);
  background: var(--primary-light);
  font-weight: 700;
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 4px;
  background: var(--primary);
  border-radius: 0 var(--radius-full) var(--radius-full) 0;
}

.nav-item-icon {
  font-size: 1.2rem;
  line-height: 1;
  flex-shrink: 0;
}

.nav-badge {
  margin-left: auto;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
}

.nav-badge.red {
  background: var(--color-missed-bg);
  color: var(--color-missed);
  border: 1px solid var(--color-missed-border);
}

.nav-badge.orange {
  background: var(--color-leave-bg);
  color: var(--color-leave);
  border: 1px solid var(--color-leave-border);
}

.sidebar-footer {
  padding: 1rem;
  border-top: 1px solid var(--border-light);
}

.sidebar-signout-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 8px;
  background: var(--color-missed-bg);
  color: var(--color-missed);
  border: 1px solid var(--color-missed-border);
  font-weight: 700;
  border-radius: var(--radius-md);
  padding: 0.65rem 1rem;
  transition: all var(--transition-fast);
  cursor: pointer;
}

.sidebar-signout-btn:hover {
  background: var(--color-missed);
  color: #ffffff;
  border-color: var(--color-missed);
}

/* Main Viewport Container */
.app-main {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 100vh;
}

/* Top Navbar */
.app-header {
  height: var(--header-height);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 30;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.header-logo {
  width: 38px;
  height: 38px;
  object-fit: contain;
  border-radius: var(--radius-sm);
  background: #ffffff;
  padding: 2px;
  border: 1px solid var(--border-light);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
  flex-shrink: 0;
}

.header-title-wrap {
  display: flex;
  flex-direction: column;
}

.header-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.2;
}

.header-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.header-clock {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-subtle);
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-full);
}

.user-profile-btn {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-full);
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.user-profile-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-medium);
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
}

.user-info-text {
  display: flex;
  flex-direction: column;
  text-align: left;
}

.user-info-name {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.2;
}

.user-role-badge {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 2px;
}

/* Main Content Area */
.app-content {
  padding: 1.5rem;
  flex: 1;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
}

/* Backdrop for Mobile Sidebar */
.mobile-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(4px);
  z-index: 35;
}
