
/* ============================================================
   CAT ACADEMY IMIPAS — css/layout.css
   VERSION 4.0 — RESPONSIVE LAYOUT & UI STABILITY

   FITUR:
   01. Responsive application shell
   02. Desktop sidebar & collapsed sidebar
   03. Mobile sidebar drawer
   04. Solid backdrop tanpa blur
   05. Sticky topbar
   06. Avatar & dropdown positioning
   07. Bottom navigation spacing
   08. Main content & container system
   09. Responsive grid utilities
   10. Authentication layout
   11. Accessibility & reduced motion
   12. Print layout
   13. Safe area support
   14. Anti horizontal overflow

   KOMPATIBILITAS:
   - js/components/navbar.js
   - js/components/sidebar.js
   - js/main.js
   - Seluruh halaman SPA

   CATATAN:
   - CSS bottom navigation utama tetap dikelola navbar.js.
   - CSS simulator ujian tetap terpisah.
   - Tidak menghapus class layout sebelumnya.
   ============================================================ */


/* ============================================================
   1. LAYOUT VARIABLES
   ============================================================ */

:root {
  --sidebar-width: 260px;
  --sidebar-width-collapsed: 72px;

  --topbar-height: 60px;

  --bottom-nav-height: 64px;
  --bottom-nav-fab-overhang: 26px;

  --layout-content-max: 1440px;

  --layout-safe-top:
    env(safe-area-inset-top, 0px);

  --layout-safe-bottom:
    env(safe-area-inset-bottom, 0px);

  --layout-safe-left:
    env(safe-area-inset-left, 0px);

  --layout-safe-right:
    env(safe-area-inset-right, 0px);

  --layout-sidebar-z: 1100;
  --layout-backdrop-z: 1090;
  --layout-topbar-z: 100;

  --layout-drawer-width: 280px;

  --layout-transition:
    240ms cubic-bezier(.2, .8, .2, 1);
}


/* ============================================================
   2. GLOBAL LAYOUT SAFETY
   ============================================================ */

.app-shell,
.app-shell *,
.auth-layout,
.auth-layout * {
  box-sizing: border-box;
}

.app-shell {
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

.app-shell img,
.app-shell video,
.app-shell canvas {
  max-width: 100%;
}

.app-shell button,
.app-shell input,
.app-shell select,
.app-shell textarea {
  font: inherit;
}

.app-shell button {
  -webkit-tap-highlight-color: transparent;
}

.app-shell a {
  -webkit-tap-highlight-color: transparent;
}


/* ============================================================
   3. APPLICATION SHELL
   ============================================================ */

.app-shell {
  display: grid;

  grid-template-columns:
    var(--sidebar-width)
    minmax(0, 1fr);

  grid-template-rows:
    minmax(100vh, auto);

  grid-template-areas:
    "sidebar body";

  min-height: 100vh;
  min-height: 100dvh;

  background:
    var(--bg-app, #0b1220);

  transition:
    grid-template-columns
    var(--layout-transition);
}

.app-shell.is-sidebar-collapsed {
  grid-template-columns:
    var(--sidebar-width-collapsed)
    minmax(0, 1fr);
}


/* ============================================================
   4. APPLICATION BODY
   ============================================================ */

.app-body {
  grid-area: body;

  display: flex;
  flex-direction: column;

  min-width: 0;
  width: 100%;
  max-width: 100%;

  min-height: 100vh;
  min-height: 100dvh;

  position: relative;

  /*
   * Jangan gunakan overflow:hidden di sini.
   * Sticky topbar membutuhkan ancestor
   * yang tidak memotong scroll.
   */
}


/* ============================================================
   5. SKIP TO CONTENT
   ============================================================ */

.skip-to-content {
  position: fixed;

  top: -120px;
  left: 12px;

  z-index: 999999;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  min-height: 44px;

  padding: 10px 16px;

  background:
    var(--accent-primary, #70a6ed);

  color:
    var(--text-on-accent, #ffffff);

  border-radius:
    var(--radius-md, 10px);

  font-size:
    var(--fs-sm, 14px);

  font-weight: 700;

  text-decoration: none;

  box-shadow:
    0 8px 24px rgba(0, 0, 0, .25);

  transition:
    top 160ms ease;
}

.skip-to-content:focus,
.skip-to-content:focus-visible {
  top: calc(
    12px + var(--layout-safe-top)
  );

  outline: 2px solid currentColor;
  outline-offset: 3px;
}


/* ============================================================
   6. DESKTOP SIDEBAR
   ============================================================ */

.app-sidebar {
  grid-area: sidebar;

  display: flex;
  flex-direction: column;

  position: sticky;
  top: 0;

  width: var(--sidebar-width);

  height: 100vh;
  height: 100dvh;

  min-width: 0;
  min-height: 0;

  padding:
    calc(
      var(--space-4, 16px) +
      var(--layout-safe-top)
    )
    var(--space-3, 12px)
    calc(
      var(--space-4, 16px) +
      var(--layout-safe-bottom)
    );

  background:
    linear-gradient(
      180deg,
      var(--bg-surface, #111c2e) 0%,
      var(--bg-app, #0b1220) 100%
    );

  border-right:
    1px solid
    var(--border-default, rgba(255,255,255,.1));

  overflow-y: auto;
  overflow-x: hidden;

  overscroll-behavior-y: contain;

  scrollbar-width: thin;

  -webkit-overflow-scrolling: touch;

  z-index:
    var(--layout-topbar-z);

  transition:
    width var(--layout-transition),
    padding var(--layout-transition);
}

.app-sidebar::-webkit-scrollbar {
  width: 5px;
}

.app-sidebar::-webkit-scrollbar-thumb {
  background:
    var(--border-default, rgba(150,150,150,.3));

  border-radius: 999px;
}


/* ============================================================
   7. COLLAPSED SIDEBAR
   ============================================================ */

.is-sidebar-collapsed .app-sidebar {
  width:
    var(--sidebar-width-collapsed);

  padding-left:
    var(--space-2, 8px);

  padding-right:
    var(--space-2, 8px);
}


/* ============================================================
   8. SIDEBAR BRAND
   ============================================================ */

.sidebar-brand {
  display: flex;
  align-items: center;

  gap: var(--space-3, 12px);

  padding:
    var(--space-2, 8px)
    var(--space-3, 12px);

  margin-bottom:
    var(--space-6, 24px);

  min-width: 0;
  min-height: 48px;

  flex-shrink: 0;

  border-radius:
    var(--radius-md, 10px);

  text-decoration: none;

  color:
    var(--text-primary, #ffffff);

  transition:
    background 160ms ease;
}

.sidebar-brand:hover {
  background:
    var(--bg-hover, rgba(255,255,255,.06));

  color:
    var(--text-primary, #ffffff);
}

.sidebar-brand-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;

  width: 40px;
  height: 40px;

  min-width: 40px;
  min-height: 40px;

  flex-shrink: 0;

  overflow: hidden;

  border-radius:
    var(--radius-md, 10px);

  background:
    var(
      --accent-gradient,
      linear-gradient(135deg,#70a6ed,#3884e6)
    );

  color:
    var(--text-on-accent, #ffffff);

  font-size:
    var(--fs-md, 16px);

  font-weight: 800;

  box-shadow:
    var(--shadow-brand, 0 6px 20px rgba(112,166,237,.2));
}

.sidebar-brand-logo img {
  display: block;

  width: 100%;
  height: 100%;

  object-fit: contain;
}

.sidebar-brand-logo svg {
  display: block;

  width: 24px;
  height: 24px;

  max-width: 24px;
  max-height: 24px;
}

.sidebar-brand-text {
  display: flex;
  flex-direction: column;

  min-width: 0;
  flex: 1;
}

.sidebar-brand-name {
  display: block;

  font-size:
    var(--fs-base, 15px);

  font-weight: 700;

  color:
    var(--text-primary, #ffffff);

  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-brand-tag {
  display: block;

  margin-top: 2px;

  font-size:
    var(--fs-2xs, 10px);

  font-weight: 600;

  color:
    var(--text-tertiary, #8a99ad);

  text-transform: uppercase;

  letter-spacing: .08em;

  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.is-sidebar-collapsed .sidebar-brand {
  justify-content: center;

  padding-left: 0;
  padding-right: 0;
}

.is-sidebar-collapsed .sidebar-brand-text {
  width: 0;
  flex: 0 0 0;

  opacity: 0;

  overflow: hidden;

  pointer-events: none;
}


/* ============================================================
   9. SIDEBAR SECTIONS
   ============================================================ */

.sidebar-section {
  margin-top:
    var(--space-4, 16px);

  margin-bottom:
    var(--space-2, 8px);

  min-width: 0;
}

.sidebar-section-label {
  display: block;

  padding:
    0 var(--space-3, 12px);

  font-size:
    var(--fs-2xs, 10px);

  font-weight: 700;

  color:
    var(--text-tertiary, #8a99ad);

  text-transform: uppercase;

  letter-spacing: .08em;

  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.is-sidebar-collapsed .sidebar-section-label {
  height: 0;
  margin: 0;
  padding: 0;

  opacity: 0;

  overflow: hidden;
}


/* ============================================================
   10. SIDEBAR NAVIGATION
   ============================================================ */

.sidebar-nav {
  display: flex;
  flex-direction: column;

  gap:
    var(--space-1, 4px);

  flex: 1;

  min-width: 0;

  padding: 0;
  margin: 0;

  list-style: none;
}

.sidebar-nav-item {
  list-style: none;

  min-width: 0;

  margin: 0;
  padding: 0;
}

.sidebar-nav-link {
  display: flex;
  align-items: center;

  gap:
    var(--space-3, 12px);

  position: relative;

  width: 100%;
  min-width: 0;
  min-height: 42px;

  padding:
    var(--space-2, 8px)
    var(--space-3, 12px);

  border-radius:
    var(--radius-md, 10px);

  color:
    var(--text-secondary, #a6b4c6);

  font-size:
    var(--fs-sm, 14px);

  font-weight: 500;

  line-height: 1.4;

  text-decoration: none;

  transition:
    background 160ms ease,
    color 160ms ease;
}

.sidebar-nav-link:hover {
  background:
    var(--bg-hover, rgba(255,255,255,.06));

  color:
    var(--text-primary, #ffffff);
}

.sidebar-nav-link.is-active,
.sidebar-nav-link[aria-current="page"] {
  background:
    var(--bg-active, rgba(112,166,237,.12));

  color:
    var(--accent-primary, #70a6ed);

  font-weight: 700;
}

.sidebar-nav-link.is-active::before,
.sidebar-nav-link[aria-current="page"]::before {
  content: "";

  position: absolute;

  left: -12px;
  top: 50%;

  width: 4px;
  height: 22px;

  transform:
    translateY(-50%);

  border-radius:
    0 4px 4px 0;

  background:
    var(--accent-primary, #70a6ed);
}


/* ============================================================
   11. SIDEBAR ICON SAFETY
   ============================================================ */

.sidebar-nav-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;

  width: 20px !important;
  height: 20px !important;

  min-width: 20px !important;
  min-height: 20px !important;

  max-width: 20px !important;
  max-height: 20px !important;

  flex: 0 0 20px;

  color: currentColor;

  overflow: hidden;
}

.sidebar-nav-icon svg,
.sidebar-nav-icon img {
  display: block;

  width: 20px !important;
  height: 20px !important;

  min-width: 20px !important;
  min-height: 20px !important;

  max-width: 20px !important;
  max-height: 20px !important;

  object-fit: contain;
}

.sidebar-nav-icon svg {
  stroke: currentColor;
}


/* ============================================================
   12. SIDEBAR LABEL
   ============================================================ */

.sidebar-nav-label {
  flex: 1;

  min-width: 0;

  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.is-sidebar-collapsed .sidebar-nav-link {
  justify-content: center;

  padding-left:
    var(--space-2, 8px);

  padding-right:
    var(--space-2, 8px);
}

.is-sidebar-collapsed .sidebar-nav-label {
  flex: 0 0 0;

  width: 0;

  opacity: 0;

  overflow: hidden;

  pointer-events: none;
}


/* ============================================================
   13. SIDEBAR FOOTER
   ============================================================ */

.sidebar-footer {
  margin-top: auto;

  padding-top:
    var(--space-4, 16px);

  border-top:
    1px solid
    var(--border-subtle, rgba(255,255,255,.08));

  flex-shrink: 0;
}

.sidebar-footer-card {
  min-width: 0;
}

.is-sidebar-collapsed .sidebar-footer-card {
  display: flex;
  align-items: center;
  justify-content: center;

  padding:
    var(--space-2, 8px);
}

.is-sidebar-collapsed
.sidebar-footer-card > :not(.sidebar-footer-icon) {
  display: none;
}


/* ============================================================
   14. SIDEBAR COLLAPSE BUTTON
   ============================================================ */

.sidebar-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;

  width: 34px;
  height: 34px;

  min-width: 34px;

  margin-left: auto;

  padding: 0;

  border:
    1px solid
    var(--border-subtle, rgba(255,255,255,.1));

  border-radius:
    var(--radius-sm, 8px);

  background: transparent;

  color:
    var(--text-tertiary, #8a99ad);

  cursor: pointer;

  transition:
    background 160ms ease,
    color 160ms ease;
}

.sidebar-toggle:hover {
  background:
    var(--bg-hover, rgba(255,255,255,.06));

  color:
    var(--text-primary, #ffffff);
}

.sidebar-toggle svg {
  width: 16px;
  height: 16px;

  max-width: 16px;
  max-height: 16px;

  transition:
    transform var(--layout-transition);
}

.is-sidebar-collapsed .sidebar-toggle svg {
  transform: rotate(180deg);
}


/* ============================================================
   15. TOPBAR
   ============================================================ */

.app-topbar {
  display: flex;
  align-items: center;

  gap:
    var(--space-3, 12px);

  position: sticky;

  top: 0;

  z-index:
    var(--layout-topbar-z);

  width: 100%;

  min-width: 0;

  height:
    calc(
      var(--topbar-height) +
      var(--layout-safe-top)
    );

  min-height:
    calc(
      var(--topbar-height) +
      var(--layout-safe-top)
    );

  padding:
    var(--layout-safe-top)
    calc(
      var(--space-4, 16px) +
      var(--layout-safe-right)
    )
    0
    calc(
      var(--space-4, 16px) +
      var(--layout-safe-left)
    );

  background:
    var(--bg-app, #0b1220);

  border-bottom:
    1px solid
    var(--border-subtle, rgba(255,255,255,.08));

  flex-shrink: 0;
}


/* ============================================================
   16. TOPBAR MENU BUTTON
   ============================================================ */

.topbar-menu-btn {
  display: none;
  align-items: center;
  justify-content: center;

  width: 40px;
  height: 40px;

  min-width: 40px;

  padding: 0;

  border: 0;

  border-radius:
    var(--radius-md, 10px);

  background: transparent;

  color:
    var(--text-primary, #ffffff);

  cursor: pointer;

  flex-shrink: 0;
}

.topbar-menu-btn:hover {
  background:
    var(--bg-hover, rgba(255,255,255,.06));
}

.topbar-menu-btn span {
  display: inline-flex;
  align-items: center;
  justify-content: center;

  width: 24px !important;
  height: 24px !important;
}

.topbar-menu-btn svg {
  display: block;

  width: 24px !important;
  height: 24px !important;

  max-width: 24px !important;
  max-height: 24px !important;

  stroke: currentColor;
}


/* ============================================================
   17. TOPBAR TITLE
   ============================================================ */

.topbar-title {
  display: flex;
  flex-direction: column;

  flex: 1;

  min-width: 0;

  overflow: hidden;
}

.topbar-title-row {
  display: flex;
  align-items: center;

  gap: 8px;

  min-width: 0;
  width: 100%;
}

.topbar-logo {
  display: block;

  width: 28px;
  height: 28px;

  min-width: 28px;

  flex-shrink: 0;

  object-fit: contain;

  border-radius: 6px;
}

.topbar-title h1 {
  min-width: 0;

  margin: 0;

  font-size:
    var(--fs-lg, 18px);

  font-weight: 700;

  line-height: 1.3;

  color:
    var(--text-primary, #ffffff);

  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-subtitle {
  min-width: 0;

  margin-top: 2px;

  font-size:
    var(--fs-xs, 12px);

  line-height: 1.3;

  color:
    var(--text-tertiary, #8a99ad);

  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}


/* ============================================================
   18. TOPBAR ACTIONS
   ============================================================ */

.topbar-actions {
  display: flex;
  align-items: center;

  gap:
    var(--space-2, 8px);

  flex-shrink: 0;

  min-width: 0;
}

.topbar-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;

  position: relative;

  width: 40px;
  height: 40px;

  min-width: 40px;

  padding: 0;

  border: 0;

  border-radius:
    var(--radius-md, 10px);

  background: transparent;

  color:
    var(--text-secondary, #a6b4c6);

  cursor: pointer;

  transition:
    background 160ms ease,
    color 160ms ease;
}

.topbar-icon-btn:hover {
  background:
    var(--bg-hover, rgba(255,255,255,.06));

  color:
    var(--text-primary, #ffffff);
}

.topbar-icon-btn svg {
  display: block;

  width: 20px !important;
  height: 20px !important;

  max-width: 20px !important;
  max-height: 20px !important;
}


/* ============================================================
   19. TOPBAR AVATAR
   ============================================================ */

.topbar-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;

  width: 38px;
  height: 38px;

  min-width: 38px;

  padding: 0;

  border-radius: 50%;

  overflow: hidden;

  background:
    var(
      --accent-gradient,
      linear-gradient(135deg,#70a6ed,#3884e6)
    );

  color:
    var(--text-on-accent, #ffffff);

  font-size:
    var(--fs-sm, 14px);

  font-weight: 700;

  border:
    2px solid
    var(--border-default, rgba(255,255,255,.12));

  cursor: pointer;

  flex-shrink: 0;
}

.topbar-avatar img {
  display: block;

  width: 100%;
  height: 100%;

  max-width: none;

  object-fit: cover;

  border-radius: 50%;
}


/* ============================================================
   20. DROPDOWN POSITIONING
   ============================================================ */

.app-topbar .dropdown {
  position: relative;

  display: inline-flex;
  align-items: center;

  flex-shrink: 0;
}

.app-topbar .dropdown-menu {
  position: absolute;

  top: calc(100% + 10px);
  right: 0;

  min-width: 220px;

  max-width:
    min(320px, calc(100vw - 24px));

  z-index: 1000;
}


/* ============================================================
   21. MAIN CONTENT
   ============================================================ */

.app-main {
  display: block;

  flex: 1 0 auto;

  width: 100%;
  min-width: 0;
  max-width: 100%;

  padding:
    var(--space-5, 20px)
    var(--space-4, 16px)
    calc(
      var(--space-8, 32px) +
      var(--layout-safe-bottom)
    );

  overflow-x: clip;
  overflow-y: visible;

  /*
   * Menggunakan scroll halaman utama
   * agar sticky topbar tetap bekerja.
   */

  scroll-margin-top:
    calc(var(--topbar-height) + 12px);
}


/* ============================================================
   22. MAIN CONTENT WITHOUT BOTTOM NAV
   ============================================================ */

.app-main.has-no-bottom-nav {
  padding-bottom:
    calc(
      var(--space-8, 32px) +
      var(--layout-safe-bottom)
    );
}


/* ============================================================
   23. FULLSCREEN MAIN
   ============================================================ */

.app-main.has-fullscreen {
  padding: 0;

  overflow: hidden;

  flex: 1 1 auto;

  min-height: 0;
}


/* ============================================================
   24. CONTAINER
   ============================================================ */

.container {
  width: 100%;

  min-width: 0;

  margin-left: auto;
  margin-right: auto;

  padding-left:
    var(--space-4, 16px);

  padding-right:
    var(--space-4, 16px);
}

.container-sm {
  max-width:
    var(--container-sm, 640px);
}

.container-md {
  max-width:
    var(--container-md, 768px);
}

.container-lg {
  max-width:
    var(--container-lg, 1024px);
}

.container-xl {
  max-width:
    var(--container-xl, 1200px);
}

.container-2xl {
  max-width:
    var(--container-2xl, 1400px);
}

.container-fluid {
  max-width: 100%;
}

.container-narrow {
  max-width: 640px;

  margin-left: auto;
  margin-right: auto;
}


/* ============================================================
   25. GRID UTILITIES
   ============================================================ */

.grid {
  display: grid;

  gap:
    var(--space-4, 16px);

  min-width: 0;
}

.grid-cols-1 {
  grid-template-columns:
    repeat(1, minmax(0, 1fr));
}

.grid-cols-2 {
  grid-template-columns:
    repeat(2, minmax(0, 1fr));
}

.grid-cols-3 {
  grid-template-columns:
    repeat(3, minmax(0, 1fr));
}

.grid-cols-4 {
  grid-template-columns:
    repeat(4, minmax(0, 1fr));
}

.grid-cols-6 {
  grid-template-columns:
    repeat(6, minmax(0, 1fr));
}

.grid-cols-12 {
  grid-template-columns:
    repeat(12, minmax(0, 1fr));
}

.grid-stats {
  display: grid;

  grid-template-columns:
    repeat(2, minmax(0, 1fr));

  gap:
    var(--space-3, 12px);
}

.grid-auto-fit {
  display: grid;

  grid-template-columns:
    repeat(
      auto-fit,
      minmax(min(100%, 240px), 1fr)
    );

  gap:
    var(--space-4, 16px);
}

.grid > *,
.grid-stats > *,
.grid-auto-fit > * {
  min-width: 0;
}


/* ============================================================
   26. DESKTOP RESPONSIVENESS
   ============================================================ */

@media (min-width: 1024px) {

  .app-sidebar {
    display: flex;
  }

  .topbar-menu-btn {
    display: none;
  }

  .app-main {
    padding-bottom:
      calc(
        var(--space-8, 32px) +
        var(--layout-safe-bottom)
      );
  }

  .app-bottom-nav {
    display: none !important;
  }

  .cat-sidebar-backdrop {
    display: none !important;
  }

}


/* ============================================================
   27. TABLET & MOBILE
   ============================================================ */

@media (max-width: 1023px) {

  .app-shell,
  .app-shell.is-sidebar-collapsed {
    display: block;

    grid-template-columns: none;
    grid-template-areas: none;

    transition: none !important;
  }

  .app-body {
    width: 100%;
    min-width: 0;
  }

  /*
   * Sidebar disembunyikan secara default.
   */

  .app-sidebar {
    display: none;

    width:
      var(--layout-drawer-width);

    max-width: 85vw;
  }

  /*
   * Sidebar mobile terbuka.
   */

  .app-sidebar.is-mobile-open {
    display: flex !important;

    position: fixed !important;

    top: 0;
    bottom: 0;
    left: 0;

    width:
      var(--layout-drawer-width);

    max-width: min(85vw, 320px);

    height: 100vh;
    height: 100dvh;

    min-height: 0;

    padding:
      calc(
        var(--space-4, 16px) +
        var(--layout-safe-top)
      )
      var(--space-3, 12px)
      calc(
        var(--space-4, 16px) +
        var(--layout-safe-bottom)
      );

    background:
      var(--bg-surface, #111c2e) !important;

    border-right:
      1px solid
      var(--border-default, rgba(255,255,255,.1));

    box-shadow:
      12px 0 40px rgba(0,0,0,.45);

    overflow-y: auto !important;
    overflow-x: hidden !important;

    overscroll-behavior: contain;

    -webkit-overflow-scrolling: touch;

    transform: translateX(0);

    animation:
      cat-sidebar-slide
      240ms cubic-bezier(.2,.8,.2,1)
      both;

    z-index:
      var(--layout-sidebar-z) !important;
  }

  /*
   * Collapsed desktop state tidak boleh
   * mengecilkan sidebar mobile.
   */

  .is-sidebar-collapsed
  .app-sidebar.is-mobile-open {
    width:
      var(--layout-drawer-width);

    max-width: min(85vw, 320px);
  }

  .is-sidebar-collapsed
  .app-sidebar.is-mobile-open
  .sidebar-brand-text {
    width: auto;
    flex: 1;

    opacity: 1;

    overflow: visible;
  }

  .is-sidebar-collapsed
  .app-sidebar.is-mobile-open
  .sidebar-nav-label {
    width: auto;
    flex: 1;

    opacity: 1;

    overflow: hidden;
  }

  .is-sidebar-collapsed
  .app-sidebar.is-mobile-open
  .sidebar-section-label {
    height: auto;
    margin: 0;

    padding:
      0 var(--space-3, 12px);

    opacity: 1;
  }

  .is-sidebar-collapsed
  .app-sidebar.is-mobile-open
  .sidebar-nav-link {
    justify-content: flex-start;

    padding:
      var(--space-2, 8px)
      var(--space-3, 12px);
  }

  .is-sidebar-collapsed
  .app-sidebar.is-mobile-open
  .sidebar-brand {
    justify-content: flex-start;

    padding:
      var(--space-2, 8px)
      var(--space-3, 12px);
  }

  /*
   * Drawer entrance.
   */

  @keyframes cat-sidebar-slide {
    from {
      transform: translateX(-100%);
    }

    to {
      transform: translateX(0);
    }
  }

  /*
   * Backdrop solid tanpa blur.
   */

  .cat-sidebar-backdrop {
    position: fixed;

    inset: 0;

    display: block;

    background:
      rgba(0, 0, 0, .66) !important;

    backdrop-filter: none !important;

    -webkit-backdrop-filter: none !important;

    opacity: 0;

    transition:
      opacity 200ms ease;

    z-index:
      var(--layout-backdrop-z);
  }

  .cat-sidebar-backdrop.is-visible {
    opacity: 1;
  }

  /*
   * Hamburger button.
   */

  .topbar-menu-btn {
    display: inline-flex;
  }

  /*
   * Bottom navigation spacing.
   */

  .app-main:not(.has-no-bottom-nav):not(.has-fullscreen) {
    padding-bottom:
      calc(
        var(--space-6, 24px) +
        var(--bottom-nav-height) +
        var(--bottom-nav-fab-overhang) +
        var(--layout-safe-bottom)
      );
  }

}


/* ============================================================
   28. SMALL TABLETS
   ============================================================ */

@media (max-width: 767px) {

  .grid-cols-4 {
    grid-template-columns:
      repeat(2, minmax(0, 1fr));
  }

  .grid-cols-6 {
    grid-template-columns:
      repeat(3, minmax(0, 1fr));
  }

  .grid-cols-12 {
    grid-template-columns:
      repeat(6, minmax(0, 1fr));
  }

  .app-topbar {
    gap:
      var(--space-2, 8px);
  }

}


/* ============================================================
   29. MOBILE
   ============================================================ */

@media (max-width: 480px) {

  .app-topbar {
    padding-left:
      calc(
        var(--space-3, 12px) +
        var(--layout-safe-left)
      );

    padding-right:
      calc(
        var(--space-3, 12px) +
        var(--layout-safe-right)
      );

    gap: 8px;
  }

  .topbar-title h1 {
    font-size:
      var(--fs-base, 15px);
  }

  .topbar-logo {
    width: 24px;
    height: 24px;

    min-width: 24px;
  }

  .topbar-actions {
    gap: 4px;
  }

  .topbar-icon-btn {
    width: 36px;
    height: 36px;

    min-width: 36px;
  }

  .topbar-avatar {
    width: 34px;
    height: 34px;

    min-width: 34px;
  }

  .app-main {
    padding:
      var(--space-4, 16px)
      var(--space-3, 12px)
      calc(
        var(--space-6, 24px) +
        var(--layout-safe-bottom)
      );
  }

  .app-main:not(.has-no-bottom-nav):not(.has-fullscreen) {
    padding-bottom:
      calc(
        var(--space-6, 24px) +
        var(--bottom-nav-height) +
        var(--bottom-nav-fab-overhang) +
        var(--layout-safe-bottom)
      );
  }

  .container {
    padding-left:
      var(--space-3, 12px);

    padding-right:
      var(--space-3, 12px);
  }

  .grid-cols-2,
  .grid-cols-3 {
    grid-template-columns:
      minmax(0, 1fr);
  }

}


/* ============================================================
   30. EXTRA SMALL MOBILE
   ============================================================ */

@media (max-width: 360px) {

  .app-topbar {
    gap: 6px;
  }

  .topbar-actions {
    gap: 2px;
  }

  .topbar-icon-btn {
    width: 32px;
    height: 36px;

    min-width: 32px;
  }

  .topbar-menu-btn {
    width: 36px;
    height: 36px;

    min-width: 36px;
  }

  .topbar-logo {
    display: none;
  }

  .topbar-title h1 {
    font-size: 14px;
  }

  .topbar-subtitle {
    font-size: 10px;
  }

  .topbar-avatar {
    width: 32px;
    height: 32px;

    min-width: 32px;
  }

}


/* ============================================================
   31. AUTHENTICATION LAYOUT
   ============================================================ */

.auth-layout {
  display: flex;
  align-items: center;
  justify-content: center;

  position: relative;

  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;

  padding:
    calc(
      var(--space-5, 20px) +
      var(--layout-safe-top)
    )
    var(--space-4, 16px)
    calc(
      var(--space-5, 20px) +
      var(--layout-safe-bottom)
    );

  background:
    radial-gradient(
      circle at 20% 0%,
      rgba(112,166,237,.15),
      transparent 55%
    ),
    radial-gradient(
      circle at 100% 100%,
      rgba(56,132,230,.10),
      transparent 55%
    ),
    linear-gradient(
      160deg,
      var(--color-navy-950, #07111f) 0%,
      var(--color-navy-900, #0b1b30) 45%,
      var(--color-navy-800, #142a45) 100%
    );

  overflow: hidden;
}

[data-theme="light"] .auth-layout {
  background:
    radial-gradient(
      circle at 20% 0%,
      rgba(112,166,237,.10),
      transparent 55%
    ),
    radial-gradient(
      circle at 100% 100%,
      rgba(56,132,230,.08),
      transparent 55%
    ),
    linear-gradient(
      160deg,
      #ffffff 0%,
      #f2f6fa 45%,
      #e6eef6 100%
    );
}

.auth-layout::before {
  content: "";

  position: absolute;

  top: -50%;
  left: -20%;

  width: 60%;
  height: 120%;

  background:
    radial-gradient(
      circle,
      rgba(160,193,235,.08) 0%,
      transparent 70%
    );

  pointer-events: none;
}


/* ============================================================
   32. AUTHENTICATION CARD
   ============================================================ */

.auth-card {
  position: relative;

  z-index: 1;

  width: 100%;
  max-width: 440px;

  min-width: 0;

  padding:
    var(--space-8, 32px)
    var(--space-6, 24px);

  background:
    var(--bg-surface, #111c2e);

  border:
    1px solid
    var(--border-default, rgba(255,255,255,.1));

  border-radius:
    var(--radius-2xl, 24px);

  box-shadow:
    var(--shadow-xl, 0 20px 60px rgba(0,0,0,.25));
}

@media (max-width: 480px) {

  .auth-card {
    padding:
      var(--space-6, 24px)
      var(--space-4, 16px);

    border-radius:
      var(--radius-xl, 18px);
  }

}


/* ============================================================
   33. FOCUS ACCESSIBILITY
   ============================================================ */

.app-shell a:focus-visible,
.app-shell button:focus-visible,
.app-shell input:focus-visible,
.app-shell select:focus-visible,
.app-shell textarea:focus-visible,
.auth-layout a:focus-visible,
.auth-layout button:focus-visible,
.auth-layout input:focus-visible {
  outline:
    2px solid
    var(--accent-primary, #70a6ed);

  outline-offset: 3px;
}


/* ============================================================
   34. TOUCH TARGETS
   ============================================================ */

@media (pointer: coarse) {

  .sidebar-nav-link {
    min-height: 44px;
  }

  .sidebar-toggle {
    min-width: 40px;
    min-height: 40px;
  }

  .topbar-menu-btn,
  .topbar-icon-btn {
    min-height: 40px;
  }

}


/* ============================================================
   35. REDUCED MOTION
   ============================================================ */

@media (prefers-reduced-motion: reduce) {

  .app-shell,
  .app-sidebar,
  .cat-sidebar-backdrop,
  .sidebar-nav-link,
  .sidebar-toggle,
  .topbar-icon-btn {
    animation-duration: .01ms !important;

    animation-iteration-count: 1 !important;

    transition-duration: .01ms !important;
  }

}


/* ============================================================
   36. PRINT LAYOUT
   ============================================================ */

@media print {

  .app-sidebar,
  .app-topbar,
  .app-bottom-nav,
  .cat-sidebar-backdrop,
  .skip-to-content {
    display: none !important;
  }

  .app-shell {
    display: block !important;

    min-height: auto;

    background: #ffffff;

    transition: none;
  }

  .app-body {
    display: block;

    min-height: auto;
  }

  .app-main {
    display: block;

    padding: 0 !important;

    margin: 0;

    overflow: visible !important;
  }

  .container {
    width: 100%;

    max-width: none;

    padding: 0;
  }

}
