/* LOGIN SCREEN (Progressive background) */
.login-screen {
  width: 100%; height: 100vh; position: relative; overflow: hidden;
  display: flex; align-items: center; justify-content: flex-end;
  padding-right: 15%; box-sizing: border-box;
}
.login-screen::before { content: ''; position: absolute; inset: 0; background: rgba(0,0,0,0); pointer-events: none; z-index: 0; }

/* Background layer for progressive loading */
.login-bg {
  position: absolute; inset: 0; z-index: 1;
  background-size: cover; background-position: center; background-repeat: no-repeat;
}
.login-bg::after {
  content: ''; position: absolute; inset: 0;
  background-size: cover; background-position: center; background-repeat: no-repeat;
  opacity: 0; transition: opacity 0.8s ease; z-index: 1; pointer-events: none;
}
.login-bg.is-loaded::after {
  opacity: 1;
}

/* Low-resolution and high-resolution backgrounds per orientation */
@media (orientation: portrait) {
  .login-bg {
    background-image: url('https://pub-23829b735d524cbaa428c0e9534df703.r2.dev/Portrait-Login-LOW.webp');
  }
  .login-bg::after {
    background-image: url('https://pub-23829b735d524cbaa428c0e9534df703.r2.dev/Portrait-Login.png');
  }
}
@media (orientation: landscape) {
  .login-bg {
    background-image: url('https://pub-23829b735d524cbaa428c0e9534df703.r2.dev/Landscape-Login-LOW.webp');
  }
  .login-bg::after {
    background-image: url('https://pub-23829b735d524cbaa428c0e9534df703.r2.dev/Landscape-Login.png');
  }
}

.login-form-wrapper {
  position: relative; z-index: 2; width: 100%; max-width: 440px;
  background: transparent; box-shadow: none; border: none; border-radius: 0;
  backdrop-filter: none; -webkit-backdrop-filter: none;
  padding: 20px 0; margin: 0; display: flex; flex-direction: column; align-items: center; text-align: center;
}
.login-form-wrapper h1 { font-size: 20px; font-weight: 800; color: var(--ink); margin-bottom: 3px; font-family: 'Plus Jakarta Sans', sans-serif; }
.login-form-wrapper p { font-size: 11px; color: var(--slate); margin-bottom: 14px; line-height: 1.5; }
.login-error-new {
  display: flex; align-items: center; gap: 8px; background: var(--danger-bg); color: var(--danger);
  border: 1px solid rgba(197,48,48,0.2); border-radius: var(--radius-sm); padding: 10px 12px;
  font-size: 10px; margin-bottom: 16px; width: 100%; text-align: left;
}
.login-field-new { width: 100%; margin-bottom: 18px; text-align: left; }
.login-field-new label {
  display: block; font-size: 11px; font-weight: 700; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--slate); margin-bottom: 8px; font-family: 'IBM Plex Mono', monospace;
}
.input-box {
  display: flex; align-items: center; gap: 12px; background: transparent;
  border: 1.5px solid var(--border-light); border-radius: 4px; padding: 4px 16px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.input-box.focused { border-color: var(--violet); box-shadow: 0 0 0 4px rgba(124,58,237,0.12); }
.input-box .icon-box {
  width: 30px; height: 30px; border-radius: 8px; background: var(--lavender-100);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.input-box .icon-box svg { width: 15px; height: 15px; color: var(--violet); }
.input-box input {
  border: none; outline: none; flex: 1; font-size: 11px; color: var(--ink); background: transparent; font-family: inherit;
}
.input-box input::placeholder { color: var(--ink-400); }
.eye-btn {
  background: none; border: none; cursor: pointer; display: flex; align-items: center; color: var(--ink-400); flex-shrink: 0; padding: 2px;
}
.eye-btn svg { width: 15px; height: 15px; }
.login-remember {
  display: flex; align-items: center; gap: 9px; font-size: 10px; color: var(--slate);
  margin-bottom: 26px; width: 100%; text-align: left;
}
.login-remember input[type="checkbox"] {
  appearance: none; width: 15px; height: 15px; border-radius: 5px; background: var(--violet);
  position: relative; cursor: pointer; flex-shrink: 0;
}
.login-remember input[type="checkbox"]::after {
  content: ""; position: absolute; left: 5px; top: 1.5px; width: 5px; height: 9px;
  border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg);
}
.signin-btn {
  width: 100%; padding: 17px 24px; border: none; border-radius: 100px;
  background: linear-gradient(135deg, var(--ink) 0%, var(--violet) 100%);
  color: #fff; font-size: 16px; font-weight: 700; display: flex; align-items: center; justify-content: center;
  gap: 10px; cursor: pointer; transition: transform .15s ease, box-shadow .15s ease;
  box-shadow: 0 12px 24px -8px rgba(76,29,149,0.45); font-family: inherit;
}
.signin-btn:hover { transform: translateY(-1px); box-shadow: 0 16px 28px -8px rgba(76,29,149,0.55); }
.signin-btn svg { width: 17px; height: 17px; }
@media (max-width: 640px){ .login-form-wrapper{ padding:20px 0; max-width:100%; } }

/* APP SHELL */
.app-shell { display: flex; min-height: 100vh; width: 100%; }
.sidebar {
  width: var(--sidebar-w); flex-shrink: 0; background: var(--ink); color: #fff;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; z-index: 50; transition: transform .25s ease;
}
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 22px 20px 18px; border-bottom: 1px solid rgba(255,255,255,0.08); }
.sidebar-brand img { height: 28px; filter: brightness(0) invert(1); }
.sidebar-brand .name { font-family: 'Plus Jakarta Sans', sans-serif; font-weight: 800; font-size: 14px; letter-spacing: .01em; }
.sidebar-brand .sub { font-family: 'IBM Plex Mono', monospace; font-size: 9.5px; color: rgba(255,255,255,0.45); letter-spacing: .1em; text-transform: uppercase; }
.sidebar-nav { flex: 1; padding: 16px 12px; overflow-y: auto; }
.sidebar-link {
  display: flex; align-items: center; gap: 11px; width: 100%; padding: 11px 13px; border-radius: var(--radius-sm);
  border: none; background: none; color: rgba(255,255,255,0.62); font-size: 13.5px; font-weight: 600; text-align: left;
  margin-bottom: 3px; transition: background .15s ease, color .15s ease;
}
.sidebar-link svg { flex-shrink: 0; }
.sidebar-link:hover { background: rgba(255,255,255,0.06); color: #fff; }
.sidebar-link.is-active { background: rgba(124,58,237,0.22); color: #fff; }
.sidebar-link .count {
  margin-left: auto; font-family: 'IBM Plex Mono', monospace; font-size: 10.5px;
  background: rgba(255,255,255,0.12); padding: 2px 7px; border-radius: 999px;
}
.sidebar-section-label { font-family: 'IBM Plex Mono', monospace; font-size: 10px; letter-spacing: .12em; color: rgba(255,255,255,0.35); text-transform: uppercase; padding: 16px 13px 6px; }
.sidebar-foot { padding: 14px 16px 18px; border-top: 1px solid rgba(255,255,255,0.08); }
.sidebar-user { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.sidebar-avatar {
  width: 34px; height: 34px; border-radius: 50%; background: linear-gradient(135deg, var(--violet), var(--navylite));
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 13px; flex-shrink: 0;
}
.sidebar-user-info { min-width: 0; }
.sidebar-user-name { font-size: 12.5px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-role { font-family: 'IBM Plex Mono', monospace; font-size: 10px; color: rgba(255,255,255,0.45); text-transform: uppercase; letter-spacing: .06em; }
.sidebar-logout {
  width: 100%; padding: 9px; border-radius: var(--radius-sm); border: 1px solid rgba(255,255,255,0.14);
  background: transparent; color: rgba(255,255,255,0.75); font-size: 12.5px; font-weight: 600;
  display: flex; align-items: center; justify-content: center; gap: 7px;
}
.sidebar-logout:hover { background: rgba(255,255,255,0.06); color: #fff; }

.main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30;
  background: rgba(247,247,251,0.92); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-color);
  padding: 14px 28px; display: flex; align-items: center; justify-content: space-between; gap: 14px;
  transition: background 0.3s, border-color 0.3s;
}
.topbar-title { font-size: 18px; font-weight: 800; color: var(--text-primary); }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.mobile-menu-btn { display: none; background: none; border: 1px solid var(--border); border-radius: 8px; width: 38px; height: 38px; align-items: center; justify-content: center; }
.security-chip {
  display: flex; align-items: center; gap: 6px; font-family: 'IBM Plex Mono', monospace; font-size: 11px;
  color: var(--success); background: var(--success-bg); border: 1px solid rgba(47,133,90,0.18);
  padding: 6px 11px; border-radius: 999px; white-space: nowrap;
}
.theme-toggle-btn {
  background: none; border: 1px solid var(--border-color); border-radius: 999px;
  padding: 6px 12px; display: flex; align-items: center; gap: 6px; font-size: 12px;
  color: var(--text-primary); background: var(--bg-card); transition: background 0.2s;
}
.theme-toggle-btn:hover { background: var(--paper); }
.theme-toggle-btn svg { width: 16px; height: 16px; }

/* ============================================================
   PAGE CONTAINER — full width (fixes right-side empty space)
   ============================================================ */
.page {
  padding: 26px 28px 60px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}
