/* ============================================================
   KDP 168 — Layout (shell, sidebar, topbar, login)
   ============================================================ */

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

/* ---------------- Sidebar ---------------- */
.sidebar {
  width: var(--sidebar-w);
  flex: none;
  background: linear-gradient(180deg, var(--sidebar-top), var(--sidebar-bottom));
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 50;
}

.brand {
  display: flex; align-items: center; gap: 13px;
  padding: 22px 22px 20px;
  border-bottom: 1px solid var(--border);
}
.brand-logo {
  width: 46px; height: 46px; border-radius: 13px; flex: none;
  background: linear-gradient(160deg, var(--primary-hover), var(--primary-strong));
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 20px;
  box-shadow: 0 10px 24px -10px var(--primary-ring);
}
.brand-text .name { font-size: 19px; font-weight: 800; letter-spacing: 0.2px; line-height: 1.1; }
.brand-text .by { font-size: 10.5px; font-weight: 600; letter-spacing: 0.18em; color: var(--text-dim); text-transform: uppercase; margin-top: 3px; }

.nav { flex: 1; overflow-y: auto; padding: 18px 14px 22px; }
.sidebar-foot { margin-top: auto; padding: 14px; border-top: 1px solid rgba(255, 255, 255, 0.08); display: flex; flex-direction: column; gap: 10px; }
.sidebar-install { width: 100%; justify-content: center; gap: 8px; background: rgba(255, 255, 255, 0.12); color: #fff; border: 1px solid rgba(255, 255, 255, 0.22); }
.sidebar-install:hover { background: rgba(255, 255, 255, 0.2); border-color: rgba(255, 255, 255, 0.32); }
.sidebar-copy { text-align: center; font-size: 11px; color: rgba(255, 255, 255, 0.45); letter-spacing: 0.02em; }
.nav-group { margin-bottom: 18px; }
.nav-group-title {
  font-size: 11px; font-weight: 700; letter-spacing: 0.13em;
  text-transform: uppercase; color: var(--text-dim);
  padding: 0 12px 9px;
}
.nav-item {
  display: flex; align-items: center; gap: 13px;
  padding: 10px 13px; margin-bottom: 3px;
  border-radius: 10px; color: var(--text-muted);
  font-size: 14.5px; font-weight: 600; cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.14s ease, color 0.14s ease, border-color 0.14s ease;
}
.nav-item i { width: 20px; text-align: center; font-size: 15px; color: var(--text-dim); transition: color 0.14s ease; }
.nav-item:hover { background: rgba(255, 255, 255, 0.04); color: var(--text); }
.nav-item:hover i { color: var(--text-muted); }
.nav-item.active {
  color: #fff;
  background: linear-gradient(180deg, rgba(47, 107, 255, 0.22), rgba(47, 107, 255, 0.12));
  border-color: var(--primary-ring);
  box-shadow: inset 0 0 0 1px rgba(47, 107, 255, 0.06), 0 8px 20px -14px var(--primary-ring);
}
.nav-item.active i { color: #9bbcff; }

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

.topbar {
  height: var(--topbar-h); flex: none;
  display: flex; align-items: center; gap: 14px;
  padding: 0 24px;
  border-bottom: 1px solid var(--border);
  background: rgba(8, 13, 26, 0.72);
  backdrop-filter: blur(10px);
  position: sticky; top: 0; z-index: 30;
}
.topbar .page-title { font-size: 16px; font-weight: 700; }
.topbar .spacer { flex: 1; }
.hamburger { display: none; }

.usermenu { position: relative; }
.usermenu-trigger {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface-2); border: 1px solid var(--border-strong);
  border-radius: 999px; padding: 5px 12px 5px 6px; cursor: pointer; color: var(--text);
}
.usermenu-trigger:hover { background: var(--surface-3); }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; flex: none;
  background: linear-gradient(160deg, var(--primary-hover), var(--primary-strong));
  color: #fff; font-size: 12px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.usermenu-trigger .u-name { font-size: 13.5px; font-weight: 600; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.usermenu-trigger .u-name small { display: block; font-size: 11px; font-weight: 500; color: var(--text-dim); }
.usermenu-trigger > i.fa-chevron-down { font-size: 11px; color: var(--text-dim); }

.dropdown {
  position: absolute; right: 0; top: calc(100% + 8px);
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--radius); box-shadow: var(--shadow);
  min-width: 210px; padding: 6px; z-index: 40;
  opacity: 0; transform: translateY(-6px); pointer-events: none;
  transition: opacity 0.14s ease, transform 0.14s ease;
}
.dropdown.open { opacity: 1; transform: none; pointer-events: auto; }
.dropdown-head { padding: 10px 12px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.dropdown-head .n { font-weight: 700; font-size: 14px; }
.dropdown-head .e { font-size: 12px; color: var(--text-dim); }
.dropdown-item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 12px; border-radius: 8px; cursor: pointer;
  font-size: 14px; color: var(--text-muted);
}
.dropdown-item i { width: 16px; text-align: center; }
.dropdown-item:hover { background: var(--surface-2); color: var(--text); }
.dropdown-item.danger:hover { color: #ff9a9d; background: var(--danger-soft); }

.content { flex: 1; padding: 28px; width: 100%; min-width: 0; }
.page-header { margin-bottom: 24px; }
.page-header h1 { margin: 0 0 6px; font-size: 23px; font-weight: 800; letter-spacing: -0.2px; }
.page-header p { margin: 0; color: var(--text-muted); font-size: 14.5px; }

/* sidebar overlay (mobile) */
.scrim {
  position: fixed; inset: 0; background: rgba(4, 8, 16, 0.6);
  z-index: 45; opacity: 0; pointer-events: none; transition: opacity 0.2s ease;
}
.scrim.open { opacity: 1; pointer-events: auto; }

/* ---------------- Login ---------------- */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.auth-card { width: 100%; max-width: 408px; }
.auth-brand { display: flex; flex-direction: column; align-items: center; text-align: center; margin-bottom: 26px; }
.auth-brand .brand-logo { width: 60px; height: 60px; border-radius: 17px; font-size: 26px; margin-bottom: 16px; }
.auth-brand .name { font-size: 25px; font-weight: 800; }
.auth-brand .by { font-size: 11px; font-weight: 600; letter-spacing: 0.2em; color: var(--text-dim); text-transform: uppercase; margin-top: 4px; }
.auth-panel { padding: 30px 28px; }
.auth-panel h1 { margin: 0 0 4px; font-size: 19px; }
.auth-panel .sub { margin: 0 0 24px; color: var(--text-muted); font-size: 14px; }
.auth-alert {
  display: none; align-items: center; gap: 10px;
  background: var(--danger-soft); border: 1px solid rgba(229, 72, 77, 0.3);
  color: #ff9a9d; border-radius: var(--radius-sm); padding: 11px 14px;
  font-size: 13.5px; margin-bottom: 18px;
}
.auth-alert.show { display: flex; }
.auth-foot { text-align: center; margin-top: 22px; color: var(--text-dim); font-size: 12px; }

/* ---------------- Responsive ---------------- */
@media (max-width: 920px) {
  .sidebar { transform: translateX(-100%); transition: transform 0.24s ease; box-shadow: var(--shadow); }
  .sidebar.open { transform: none; }
  .main { margin-left: 0; }
  .hamburger { display: inline-flex; }
  .content { padding: 20px 16px; }
  .usermenu-trigger .u-name { display: none; }
  .page-header h1 { font-size: 20px; }
}
@media (max-width: 520px) {
  .topbar { padding: 0 14px; }
  .modal-foot { flex-direction: column-reverse; }
  .modal-foot .btn { width: 100%; justify-content: center; }
}

/* Brand mark kini berupa gambar logo bulat (transparan), bukan kotak gradien */
img.brand-logo { background: none; box-shadow: none; object-fit: contain; padding: 0; }
html[data-theme="light"] img.brand-logo,
html[data-theme="light"] .sidebar img.brand-logo { background: none; box-shadow: none; }
