/* AGG-UAE ERP — Layout (shell) */

/* ── Login screen ──────────────────────────────────────── */
body.login-bg {
  min-height: 100vh;
  background: linear-gradient(135deg, #0b1220 0%, #1a3050 60%, #0b1220 100%);
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.login-card {
  width: 100%; max-width: 420px;
  background: var(--bg-2); border-radius: var(--r-lg);
  padding: 40px 36px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.45);
}
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo img { height: 56px; width: auto; margin: 0 auto; }
.login-title {
  text-align: center; margin-bottom: 4px;
  font-size: 1.25rem; color: var(--text);
}
.login-sub {
  text-align: center; color: var(--text-3);
  font-size: 0.85rem; margin-bottom: 28px;
}
.login-card .form-group:last-of-type { margin-bottom: 24px; }
.login-card .btn { width: 100%; padding: 13px 22px; }
.login-foot {
  margin-top: 28px; padding-top: 20px;
  border-top: 1px solid var(--border);
  text-align: center; font-size: 0.75rem; color: var(--text-3);
}

/* ── App shell ─────────────────────────────────────────── */
body.app {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-w); flex-shrink: 0;
  background: var(--bg-2); border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; bottom: 0; z-index: 100;
  transition: width var(--t-base) var(--ease);
}
.sidebar-head {
  height: var(--topbar-h); padding: 0 20px;
  display: flex; align-items: center; gap: 10px;
  border-bottom: 1px solid var(--border);
}
.sidebar-head img { height: 36px; width: auto; }
.sidebar-head .brand-text {
  font-family: var(--fnt-h); font-size: 0.95rem; font-weight: 700;
  color: var(--text); letter-spacing: 0.04em; line-height: 1.1;
}
.sidebar-head .brand-text small {
  display: block; font-size: 0.62rem; font-weight: 500;
  color: var(--text-3); letter-spacing: 0.18em; text-transform: uppercase;
  margin-top: 2px;
}

.sidebar-nav {
  flex: 1; overflow-y: auto;
  padding: 16px 12px;
}
.nav-section {
  font-family: var(--fnt-h); font-size: 0.65rem; font-weight: 700;
  letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--text-3); padding: 16px 12px 8px;
}
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 12px; margin-bottom: 2px;
  font-family: var(--fnt-h); font-size: 0.92rem; font-weight: 500;
  letter-spacing: 0.03em;
  color: var(--text-2); border-radius: var(--r);
  transition: var(--t-fast);
}
.nav-item:hover {
  background: var(--bg-3); color: var(--text);
}
.nav-item.active {
  background: var(--steel-xlt); color: var(--steel);
  font-weight: 600;
}
.nav-item.active .nav-icon svg { color: var(--steel); }
.nav-icon {
  width: 20px; height: 20px;
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0; color: var(--text-3);
}
.nav-item:hover .nav-icon { color: var(--text-2); }
.nav-label { flex: 1; }

.sidebar-foot {
  padding: 12px; border-top: 1px solid var(--border);
}

/* Top bar */
.topbar {
  position: fixed; top: 0; left: var(--sidebar-w); right: 0;
  height: var(--topbar-h); z-index: 90;
  background: var(--bg-2); border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 24px;
}
.topbar-left { flex: 1; display: flex; align-items: center; gap: 16px; }
.topbar-right { display: flex; align-items: center; gap: 8px; }

.topbar .breadcrumb { font-size: 0.85rem; }

.topbar-icon-btn {
  position: relative;
  width: 36px; height: 36px;
  background: transparent; border: none; border-radius: var(--r);
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-2); cursor: pointer; transition: var(--t-fast);
}
.topbar-icon-btn:hover { background: var(--bg-3); color: var(--text); }
.topbar-icon-btn .badge {
  position: absolute; top: 4px; right: 4px;
  min-width: 16px; height: 16px;
  padding: 0 4px; border-radius: 8px;
  background: var(--danger); color: #fff;
  font-size: 0.62rem; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
}

.user-chip {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 12px 6px 6px; border-radius: var(--r-pill);
  background: var(--bg-3); cursor: pointer;
  transition: var(--t-fast);
  position: relative;
}
.user-chip:hover { background: var(--bg-4); }
.user-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--grad-steel); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--fnt-h); font-size: 0.78rem; font-weight: 700;
  letter-spacing: 0.04em;
}
.user-name {
  font-family: var(--fnt-h); font-size: 0.88rem; font-weight: 600;
  color: var(--text);
}

/* User dropdown menu */
.user-menu {
  position: absolute; top: calc(100% + 6px); right: 0; z-index: 200;
  min-width: 220px;
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--r); box-shadow: var(--shadow-lg);
  padding: 6px; display: none;
}
.user-menu.open { display: block; }
.user-menu .menu-info {
  padding: 12px 14px; border-bottom: 1px solid var(--border); margin-bottom: 6px;
}
.user-menu .menu-info strong { display: block; color: var(--text); font-family: var(--fnt-h); }
.user-menu .menu-info span { font-size: 0.78rem; color: var(--text-3); }
.user-menu a {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 14px; color: var(--text-2); font-size: 0.9rem;
  border-radius: var(--r);
}
.user-menu a:hover { background: var(--bg-3); color: var(--text); }
.user-menu a.danger { color: var(--danger); }

/* Main content */
.main {
  flex: 1; margin-left: var(--sidebar-w); margin-top: var(--topbar-h);
  padding: 24px 32px 48px;
  min-height: calc(100vh - var(--topbar-h));
  max-width: calc(100vw - var(--sidebar-w));
}
.main-inner { max-width: 1320px; margin: 0 auto; }

/* ── Dashboard tiles ───────────────────────────────────── */
.kpi-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px; margin-bottom: 32px;
}
.kpi {
  background: var(--bg-2); border: 1px solid var(--border-strong);
  border-radius: var(--r-lg); padding: 22px;
  box-shadow: var(--shadow);
}
.kpi-label {
  font-family: var(--fnt-h); font-size: 0.78rem; font-weight: 700;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--text-2); margin-bottom: 10px;
}
.kpi-value {
  font-family: var(--fnt-h); font-size: 2rem; font-weight: 700;
  color: var(--text); line-height: 1.1;
}
.kpi-sub { font-size: 0.85rem; color: var(--text-3); margin-top: 6px; }

/* ── Welcome panel ─────────────────────────────────────── */
.welcome {
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 32px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
  background-image: linear-gradient(135deg, var(--steel-xlt) 0%, transparent 60%);
}
.welcome h2 { color: var(--text); margin-bottom: 8px; }
.welcome p { color: var(--text-2); font-size: 0.95rem; }

/* ── Responsive ────────────────────────────────────────── */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .topbar { left: 0; }
  .main { margin-left: 0; max-width: 100vw; padding: 16px; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
}
