/* =====================================================================
   LPPM ISTN — Application Shell & Layout
   ===================================================================== */

/* ---------------------------------------------------------- Demo banner */
.demo-ribbon {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--ribbon-h);
  z-index: 67;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: var(--ribbon-h);
  padding: 4px 14px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--navy-950);
  background: linear-gradient(90deg, var(--gold-600), var(--gold-300) 45%, var(--gold-500));
  border-bottom: 1px solid rgba(6, 24, 44, 0.18);
  text-align: center;
}

.demo-ribbon span {
  white-space: nowrap;
}

.demo-ribbon .dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--navy-900);
  opacity: 0.55;
}

/* ------------------------------------------------------------- App shell */
.app-shell {
  display: flex;
  min-height: 100vh;
  padding-top: var(--ribbon-h);
  background: var(--bg);
}

.app-main {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  margin-left: var(--sidebar-w);
  transition: margin-left var(--t) var(--ease);
}

.app-shell.is-collapsed .app-main {
  margin-left: var(--sidebar-w-collapsed);
}

.app-body {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.page-wrap {
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: var(--sp-6) var(--sp-7) var(--sp-7);
  flex: 1 1 auto;
}

/* --------------------------------------------------------------- Sidebar */
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  top: var(--ribbon-h);
  width: var(--sidebar-w);
  z-index: var(--z-sidebar);
  display: flex;
  flex-direction: column;
  background: linear-gradient(185deg, var(--navy-950) 0%, var(--navy-900) 42%, var(--navy-850) 100%);
  color: var(--on-dark);
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  transition: width var(--t) var(--ease), transform var(--t) var(--ease);
  overflow: hidden;
}

.sidebar::after {
  content: "";
  position: absolute;
  top: -60px;
  right: -80px;
  width: 220px;
  height: 220px;
  background: radial-gradient(circle, rgba(217, 171, 43, 0.16), transparent 68%);
  pointer-events: none;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 16px 16px 14px;
  min-height: 68px;
  border-bottom: 1px solid var(--border-dark);
  text-decoration: none;
  color: var(--on-dark);
  flex: 0 0 auto;
}

.sidebar-brand:hover {
  text-decoration: none;
}

.brand-mark {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: linear-gradient(160deg, var(--gold-500), var(--gold-700));
  color: var(--navy-950);
  font-weight: 800;
  font-size: 15px;
  letter-spacing: -0.02em;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.28), var(--shadow-inset);
}

.brand-text {
  min-width: 0;
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.brand-title {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.brand-sub {
  font-size: 10px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--gold-300);
  font-weight: 600;
  white-space: nowrap;
  margin-top: 2px;
}

.sidebar-scroll {
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 10px 10px 14px;
}

.sidebar-scroll::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.22);
}

.sidebar-section {
  margin-top: 14px;
}

.sidebar-section:first-child {
  margin-top: 4px;
}

.sidebar-label {
  padding: 6px 10px 5px;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--on-dark-soft);
  opacity: 0.72;
  white-space: nowrap;
}

.sidebar-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  margin: 1px 0;
  border-radius: var(--radius-sm);
  color: #cfdcec;
  font-size: var(--fs-base);
  font-weight: 500;
  text-decoration: none;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
  white-space: nowrap;
}

.sidebar-link:hover {
  background: rgba(255, 255, 255, 0.075);
  color: #ffffff;
  text-decoration: none;
}

.sidebar-link.is-active {
  background: linear-gradient(90deg, rgba(217, 171, 43, 0.22), rgba(217, 171, 43, 0.06));
  color: #ffffff;
  font-weight: 600;
  box-shadow: inset 0 0 0 1px rgba(217, 171, 43, 0.22);
}

.sidebar-link.is-active::before {
  content: "";
  position: absolute;
  left: -10px;
  top: 6px;
  bottom: 6px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--gold-500);
}

.sidebar-link .ico {
  flex: 0 0 18px;
  width: 18px;
  height: 18px;
  opacity: 0.92;
}

.sidebar-link .lbl {
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-link .tag {
  flex: 0 0 auto;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.12);
  color: var(--on-dark-soft);
}

.sidebar-link.is-active .tag {
  background: rgba(217, 171, 43, 0.28);
  color: #ffe9a8;
}

.sidebar-link .count {
  flex: 0 0 auto;
  min-width: 19px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  font-size: 10px;
  font-weight: 700;
  background: var(--gold-500);
  color: var(--navy-950);
}

/* Collapsed sidebar */
.app-shell.is-collapsed .sidebar .brand-text,
.app-shell.is-collapsed .sidebar .sidebar-label,
.app-shell.is-collapsed .sidebar .lbl,
.app-shell.is-collapsed .sidebar .tag,
.app-shell.is-collapsed .sidebar .count,
.app-shell.is-collapsed .sidebar .sidebar-foot-text {
  display: none;
}

.app-shell.is-collapsed .sidebar-brand {
  justify-content: center;
  padding-left: 0;
  padding-right: 0;
}

.app-shell.is-collapsed .sidebar-link {
  justify-content: center;
  padding-left: 0;
  padding-right: 0;
}

.app-shell.is-collapsed .sidebar-section {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.app-shell.is-collapsed .sidebar-section:first-child {
  border-top: 0;
}

.app-shell.is-collapsed .sidebar-scroll {
  padding-left: 9px;
  padding-right: 9px;
}

.sidebar-foot {
  flex: 0 0 auto;
  border-top: 1px solid var(--border-dark);
  padding: 10px;
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 10.5px;
  color: var(--on-dark-soft);
  line-height: 1.35;
}

.sidebar-foot .ver {
  font-weight: 700;
  color: var(--gold-300);
}

/* ---------------------------------------------------------------- Topbar */
.topbar {
  position: sticky;
  top: var(--ribbon-h);
  z-index: var(--z-topbar);
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 18px;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 0 rgba(15, 32, 55, 0.02);
}

.icon-btn {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  display: grid;
  place-items: center;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-soft);
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}

.icon-btn:hover {
  background: var(--surface-3);
  color: var(--navy-900);
}

.icon-btn svg {
  width: 19px;
  height: 19px;
}

.topbar-crumbs {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  font-size: var(--fs-sm);
  color: var(--muted);
}

.topbar-crumbs .home {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
}

.topbar-crumbs .sep {
  color: var(--muted-2);
  font-size: 11px;
}

.topbar-crumbs .current {
  color: var(--text);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-search {
  margin-left: auto;
  position: relative;
  width: min(340px, 30vw);
}

.topbar-search input {
  width: 100%;
  height: 36px;
  padding: 0 12px 0 34px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--surface-3);
  font-size: var(--fs-sm);
  color: var(--text);
  transition: border-color var(--t-fast), background var(--t-fast), box-shadow var(--t-fast);
}

.topbar-search input::placeholder {
  color: var(--muted-2);
}

.topbar-search input:focus {
  outline: none;
  background: var(--surface);
  border-color: var(--royal-500);
  box-shadow: 0 0 0 3px var(--royal-100);
}

.topbar-search .s-ico {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  width: 15px;
  height: 15px;
  color: var(--muted-2);
  pointer-events: none;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}

.topbar-search + .topbar-actions {
  margin-left: 0;
}

.badge-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--danger);
  border: 2px solid var(--surface);
}

.has-dot {
  position: relative;
}

/* Role switcher */
.role-switch {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 10px 0 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: var(--fs-sm);
  font-weight: 600;
  transition: border-color var(--t-fast), background var(--t-fast);
  max-width: 240px;
}

.role-switch:hover {
  border-color: var(--border-strong);
  background: var(--surface-2);
}

.role-switch .rs-avatar {
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  border-radius: 7px;
  display: grid;
  place-items: center;
  background: var(--royal-100);
  color: var(--royal-700);
  font-size: 10px;
  font-weight: 800;
}

.role-switch .rs-text {
  min-width: 0;
  display: flex;
  flex-direction: column;
  line-height: 1.1;
  text-align: left;
}

.role-switch .rs-label {
  font-size: 9px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
}

.role-switch .rs-name {
  font-size: var(--fs-sm);
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 150px;
}

.role-switch .chev {
  width: 13px;
  height: 13px;
  color: var(--muted);
  flex: 0 0 13px;
}

/* Dropdown menus */
.dropdown {
  position: relative;
}

.dropdown-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 230px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 6px;
  z-index: 70;
  opacity: 0;
  transform: translateY(-6px);
  pointer-events: none;
  transition: opacity var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
  max-height: min(72vh, 560px);
  overflow-y: auto;
}

.dropdown.is-open .dropdown-panel {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.dropdown-panel.is-wide {
  min-width: 320px;
}

.dropdown-head {
  padding: 8px 10px 9px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 5px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.dropdown-head strong {
  font-size: var(--fs-sm);
  letter-spacing: 0.02em;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--text);
  font-size: var(--fs-sm);
  text-align: left;
  text-decoration: none;
}

.dropdown-item:hover {
  background: var(--surface-3);
  text-decoration: none;
}

.dropdown-item.is-active {
  background: var(--royal-50);
  color: var(--royal-700);
  font-weight: 700;
}

.dropdown-item .di-ico {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  color: var(--muted);
}

.dropdown-item .di-main {
  min-width: 0;
  flex: 1 1 auto;
}

.dropdown-item .di-title {
  font-weight: 600;
  font-size: var(--fs-sm);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dropdown-item .di-meta {
  font-size: 10.5px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dropdown-sep {
  height: 1px;
  background: var(--border);
  margin: 5px 0;
}

.role-option .di-title {
  display: flex;
  align-items: center;
  gap: 6px;
}

.role-option .di-desc {
  font-size: 10.5px;
  color: var(--muted);
  line-height: 1.35;
  white-space: normal;
}

.role-option.is-active {
  background: var(--royal-50);
}

.role-option.is-active .di-title {
  color: var(--royal-700);
}

/* Notification items */
.notif-item {
  display: flex;
  gap: 9px;
  padding: 8px 10px;
  border-radius: var(--radius-xs);
  align-items: flex-start;
}

.notif-item:hover {
  background: var(--surface-3);
}

.notif-item .n-ico {
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--royal-50);
  color: var(--royal-600);
}

.notif-item .n-body {
  min-width: 0;
  flex: 1 1 auto;
}

.notif-item .n-title {
  font-size: var(--fs-sm);
  font-weight: 600;
  line-height: 1.35;
}

.notif-item .n-time {
  font-size: 10.5px;
  color: var(--muted);
  margin-top: 1px;
}

/* --------------------------------------------------------------- Footer */
.app-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 14px var(--sp-7);
  font-size: var(--fs-sm);
  color: var(--muted);
}

.app-footer-inner {
  max-width: var(--content-max);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.app-footer .f-brand {
  font-weight: 700;
  color: var(--text-soft);
}

.app-footer .f-links {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.app-footer a {
  color: var(--muted);
}

.app-footer a:hover {
  color: var(--royal-600);
}

/* ---------------------------------------------------------- Page header */
.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-5);
  margin-bottom: var(--sp-5);
  flex-wrap: wrap;
}

.page-head-main {
  min-width: 0;
}

.page-eyebrow {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--royal-600);
  margin-bottom: 5px;
}

.page-title {
  font-size: 25px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--navy-900);
  margin: 0;
}

.page-subtitle {
  margin-top: 5px;
  color: #5b6779;
  font-size: var(--fs-md);
  max-width: 82ch;
}

.page-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* Breadcrumb (in page) */
.crumbs {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-sm);
  color: var(--muted);
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.crumbs a {
  color: var(--muted);
}

.crumbs a:hover {
  color: var(--royal-600);
}

.crumbs .sep {
  color: var(--muted-2);
}

.crumbs .cur {
  color: var(--text-soft);
  font-weight: 600;
}

/* --------------------------------------------------------------- Backdrop */
.backdrop {
  position: fixed;
  inset: 0;
  z-index: var(--z-backdrop);
  background: var(--overlay);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--t) var(--ease);
}

.backdrop.is-open {
  opacity: 1;
  pointer-events: auto;
}

/* ------------------------------------------------------------ Page loader */
.app-loading {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: var(--navy-950);
  color: var(--on-dark);
  z-index: 200;
  text-align: center;
  gap: 14px;
}

.app-loading .load-mark {
  width: 54px;
  height: 54px;
  margin: 0 auto 14px;
  border-radius: 14px;
  background: linear-gradient(160deg, var(--gold-500), var(--gold-700));
  display: grid;
  place-items: center;
  font-weight: 800;
  color: var(--navy-950);
  font-size: 18px;
  animation: pulseMark 1.6s ease-in-out infinite;
}

.app-loading .load-title {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.app-loading .load-sub {
  font-size: 12px;
  color: var(--on-dark-soft);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-top: 4px;
}

@keyframes pulseMark {
  0%, 100% { transform: translateY(0); box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3); }
  50% { transform: translateY(-5px); box-shadow: 0 14px 30px rgba(0, 0, 0, 0.38); }
}

/* Skeleton */
.skeleton {
  background: linear-gradient(90deg, #eef2f7 25%, #f7f9fc 37%, #eef2f7 63%);
  background-size: 400% 100%;
  animation: shimmer 1.4s ease infinite;
  border-radius: 6px;
}

@keyframes shimmer {
  0% { background-position: 100% 50%; }
  100% { background-position: 0 50%; }
}

/* --------------------------------------------------- Inline SVG sizing */
/* C.icon() menghasilkan SVG tanpa atribut width/height; pastikan setiap
   wadah berukuran kecil menetapkan ukuran ikon secara eksplisit. */
.page-eyebrow > svg { width: 14px; height: 14px; flex: 0 0 14px; }
.topbar-search .s-ico svg { width: 15px; height: 15px; }
.sidebar-link .ico svg { width: 18px; height: 18px; }
.sidebar-brand .brand-mark svg { width: 20px; height: 20px; }
.role-switch .chev svg { width: 13px; height: 13px; }
.dropdown-item .di-ico svg { width: 16px; height: 16px; }
.notif-item .n-ico svg { width: 14px; height: 14px; }
.toast .t-ico svg { width: 17px; height: 17px; }
.metric-item .mi-val svg { width: 14px; height: 14px; }
.badge svg { width: 11px; height: 11px; }
.chip svg { width: 12px; height: 12px; }
