/* ===== APP LAYOUT ===== */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: 220px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 24px 0;
  display: flex;
  flex-direction: column;
  position: fixed;
  height: 100vh;
  overflow-y: auto;
}

.main { margin-left: 220px; flex: 1; padding: 32px 28px; min-width: 0; }

.logo {
  padding: 0 20px 24px;
  font-size: 18px;
  font-weight: 700;
  background: var(--grad);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.logo small {
  color: var(--muted);
  font-size: 11px;
  display: block;
  font-weight: 400;
  margin-top: 2px;
  -webkit-text-fill-color: var(--muted);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  cursor: pointer;
  color: var(--muted);
  transition: all 0.15s;
  border-left: 3px solid transparent;
  font-size: 13px;
}
.nav-item:hover { color: var(--text); background: rgba(255,255,255,0.04); }
.nav-item.active {
  color: var(--accent);
  background: rgba(79,142,247,0.08);
  border-left-color: var(--accent);
}
.nav-icon { font-size: 15px; width: 20px; text-align: center; }
.nav-section {
  padding: 16px 20px 6px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
  opacity: .6;
}

.sidebar-bottom { padding: 16px 20px 0; margin-top: auto; }
.year-select {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 10px;
  border-radius: var(--radius);
  font-size: 13px;
  cursor: pointer;
}

.page { display: none; max-width: 1400px; width: 100%; margin: 0 auto; }
.page.active { display: block; }

/* ===== AUTH SCREEN ===== */
.auth-screen {
  position: fixed; inset: 0;
  background: var(--bg);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.auth-card {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 40px 36px;
  width: 100%;
  max-width: 440px;
  backdrop-filter: blur(12px);
}
.auth-logo {
  font-size: 28px;
  font-weight: 800;
  background: var(--grad);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 4px;
}
.auth-logo small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
  display: block;
  -webkit-text-fill-color: var(--muted);
}
.auth-title { font-size: 18px; font-weight: 700; margin: 24px 0 6px; }
.auth-sub { font-size: 13px; color: var(--muted); margin-bottom: 24px; }
.auth-field { margin-bottom: 14px; }
.auth-field label {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  display: block;
  margin-bottom: 5px;
}
.auth-field input {
  width: 100%;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 11px 13px;
  border-radius: 10px;
  font-size: 14px;
  outline: none;
  transition: border-color .15s;
}
.auth-field input:focus { border-color: var(--accent); }
.auth-hint { font-size: 11px; color: var(--muted); margin-top: 4px; }
.auth-btn {
  width: 100%;
  padding: 12px;
  background: var(--grad);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity .15s, transform .15s;
  margin-top: 6px;
}
.auth-btn:hover { opacity: .88; transform: translateY(-1px); }
.auth-link {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 13px;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
}
.auth-divider {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  margin: 18px 0;
  position: relative;
}
.auth-divider::before,
.auth-divider::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 42%;
  height: 1px;
  background: var(--border);
}
.auth-divider::before { left: 0; }
.auth-divider::after  { right: 0; }

.user-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(90px,1fr)); gap: 12px; margin: 20px 0; }
.user-btn {
  background: rgba(255,255,255,0.04);
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 14px 8px;
  cursor: pointer;
  text-align: center;
  transition: all .15s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.user-btn:hover { border-color: var(--accent); }
.user-btn.selected { border-color: var(--accent); background: rgba(79,142,247,.1); }
.avatar-circle {
  width: 44px; height: 44px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 700; color: #fff; flex-shrink: 0;
}
.user-btn-name { font-size: 11px; color: var(--text); font-weight: 600; word-break: break-all; }

#auth-toast {
  position: fixed;
  bottom: 30px; left: 50%;
  transform: translateX(-50%);
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 11px 20px;
  font-size: 13px;
  z-index: 600;
  opacity: 0;
  transition: opacity .3s;
  pointer-events: none;
  white-space: nowrap;
}
#auth-toast.show { opacity: 1; }

/* ===== SIDEBAR PROFILE ===== */
.sidebar-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  margin: 8px 10px 0;
  border-radius: 10px;
  cursor: pointer;
  border: 1px solid var(--border);
  transition: all .15s;
  position: relative;
}
.sidebar-profile:hover { background: rgba(255,255,255,0.05); }
.sidebar-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: #fff; flex-shrink: 0;
}
.sidebar-profile-info { flex: 1; min-width: 0; }
.sidebar-username { font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-role { font-size: 10px; color: var(--muted); }

.profile-menu {
  display: none;
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0; right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 6px;
  z-index: 100;
  box-shadow: var(--shadow);
}
.profile-menu.open { display: block; }
.profile-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 7px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text);
  transition: background .1s;
}
.profile-menu-item:hover { background: rgba(255,255,255,0.05); }
.profile-menu-item.danger { color: var(--red); }

@media (max-width: 1100px) {
  .main { padding: 24px 28px; }
}
@media (max-width: 760px) {
  .sidebar { width: 56px; }
  .nav-item span:not(.nav-icon) { display: none; }
  .nav-section, .logo small, .sidebar-bottom label { display: none; }
  .main { margin-left: 56px; padding: 14px 16px; }
  .pick-grid { grid-template-columns: 1fr; }
}
