
/* ==================================================
   CLAUDEPRO — COMPACT PREMIUM V2
   Skills, Settings, Chat Layout & Responsive Design
   ================================================== */

/* ---------- SKILL AI ---------- */

#cp-enhance {
  --cp-accent: #df8e6d;
  --cp-panel: #252525;
  --cp-edge: #48413f;
  --cp-copy: #f5eee9;

  font-family: Inter, system-ui, sans-serif;
  color: var(--cp-copy);
  margin: 4px auto 7px;
  max-width: 880px;
  width: 100%;
}

#cp-enhance * {
  box-sizing: border-box;
}

#cp-enhance .cp-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 7px;
}

#cp-enhance .cp-eyebrow {
  font-size: 10px;
  letter-spacing: .09em;
  color: #aba4a1;
  font-weight: 700;
}

#cp-enhance .cp-active {
  font-size: 10px;
  color: #ecaa8a;
  text-align: right;
}

#cp-enhance .cp-skills {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}

#cp-enhance button {
  font-family: inherit;
  cursor: pointer;
}

#cp-enhance .cp-skill {
  padding: 6px 9px;
  border: 1px solid var(--cp-edge);
  border-radius: 9px;
  background: #1d1d1d;
  color: #ddd;
  font-size: 11px;
  line-height: 1.25;
  white-space: nowrap;
  transition: background .15s, transform .15s;
}

#cp-enhance .cp-skill:hover {
  border-color: var(--cp-accent);
  background: #302722;
  transform: translateY(-1px);
}

#cp-enhance .cp-skill[aria-pressed="true"] {
  background: linear-gradient(135deg, #cf7656, #e59b76);
  color: #fff;
  border-color: transparent;
  font-weight: 700;
}

#cp-enhance .cp-sub {
  margin: 5px 0 0;
  font-size: 10px;
  line-height: 1.35;
  color: #aaa29d;
}

/* ---------- SETTINGS BUTTON ---------- */

#cp-settings-launch {
  position: fixed;
  right: 20px;
  top: 18px;
  z-index: 9997;

  border: 1px solid #57504c;
  border-radius: 9px;
  background: #252525;
  color: #fff;

  padding: 7px 11px;
  box-shadow: 0 6px 16px #0004;

  font: 600 11px system-ui;
  cursor: pointer;
}

#cp-settings-launch:hover {
  background: #37302d;
}

#cp-settings-launch.cp-settings-inline {
  position: static;
  box-shadow: none;
}

/* ---------- SETTINGS MODAL ---------- */

#cp-settings-panel[hidden],
#cp-settings-shade[hidden] {
  display: none !important;
}

#cp-settings-shade {
  position: fixed;
  inset: 0;
  background: #000a;
  z-index: 9998;
}

#cp-settings-panel {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 9999;

  width: min(92vw, 420px);
  max-height: 85vh;
  overflow: auto;

  background: #242424;
  color: #f4eee8;
  border: 1px solid #514844;
  border-radius: 16px;
  padding: 20px;

  box-shadow: 0 25px 70px #0009;
  font: 13px system-ui;
}

#cp-settings-panel .cp-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

#cp-settings-panel h2 {
  font-size: 18px;
  margin: 0;
}

#cp-settings-panel .cp-muted {
  color: #bcb2ad;
  font-size: 11px;
  margin: 0 0 16px;
}

#cp-settings-panel label {
  display: block;
  margin: 12px 0 6px;
  font-size: 12px;
  color: #d3c6bf;
  font-weight: 600;
}

#cp-settings-panel select {
  width: 100%;
  padding: 10px;
  background: #171717;
  color: white;
  border: 1px solid #534944;
  border-radius: 9px;
  font: inherit;
}

#cp-settings-panel button {
  border: 1px solid #625450;
  border-radius: 9px;
  padding: 8px 11px;
  background: #34302e;
  color: #fff;
  cursor: pointer;
}

#cp-settings-panel .cp-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 20px;
}

#cp-settings-panel .cp-save {
  background: #c97957;
  border-color: #c97957;
  font-weight: 700;
}

/* ---------- THEME LIGHT ---------- */

body.cp-theme-light {
  background: #faf8f5 !important;
  color: #222 !important;
}

body.cp-theme-light #cp-enhance {
  --cp-panel: #fff;
  --cp-copy: #302a28;
  --cp-edge: #e0d2cc;
}

body.cp-theme-light #cp-enhance .cp-skill {
  background: #fff;
  color: #342d2a;
}

body.cp-theme-light #cp-enhance .cp-skill[aria-pressed="true"] {
  background: #c97957;
  color: #fff;
}

body.cp-theme-light #cp-enhance .cp-eyebrow,
body.cp-theme-light #cp-enhance .cp-sub {
  color: #655d58;
}

body.cp-theme-light #cp-enhance .cp-active {
  color: #9d4e2d;
}

body.cp-theme-light #cp-settings-panel {
  background: #fff;
  color: #302a28;
  border-color: #e0d2cc;
}

body.cp-theme-light #cp-settings-panel .cp-muted,
body.cp-theme-light #cp-settings-panel label {
  color: #655d58;
}

body.cp-theme-light #cp-settings-panel select {
  background: #faf8f5;
  color: #302a28;
  border-color: #e0d2cc;
}

/* ---------- FONT PREFERENCES ---------- */

body.cp-font-small #cp-enhance .cp-skill {
  font-size: 10px;
}

body.cp-font-large #cp-enhance .cp-skill {
  font-size: 13px;
}

body.cp-font-small .assistant .bubble,
body.cp-font-small .user .bubble {
  font-size: 12px !important;
}

body.cp-font-large .assistant .bubble,
body.cp-font-large .user .bubble {
  font-size: 15px !important;
}

body.cp-compact #cp-enhance .cp-skill {
  padding: 5px 8px;
}

/* ==========================================
   COMPACT PREMIUM — MAIN LAYOUT
   ========================================== */

/* ---------- SIDEBAR DESKTOP ---------- */

@media (min-width: 801px) {
  .app {
    grid-template-columns: 225px minmax(0, 1fr) !important;
  }

  aside {
    padding: 15px 10px 12px !important;
  }

  .brand {
    font-size: 18px !important;
    gap: 9px !important;
  }

  .brand-icon {
    width: 34px !important;
    height: 34px !important;
    border-radius: 10px !important;
    font-size: 19px !important;
  }

  .brand-caption {
    font-size: 9px !important;
    margin-left: 52px !important;
  }

  .nav-group {
    margin-top: 20px !important;
  }

  .nav-label {
    font-size: 9px !important;
    margin-bottom: 7px !important;
  }

  .nav {
    padding: 9px 10px !important;
    margin: 2px 0 !important;
    font-size: 12px !important;
    border-radius: 9px !important;
    gap: 9px !important;
  }

  .nav .ico {
    font-size: 15px !important;
    width: 18px !important;
  }

  .thread-section {
    margin: 10px 0 8px !important;
  }

  .thread-head {
    padding: 9px 9px 6px !important;
    font-size: 9px !important;
  }

  .thread-open {
    padding: 7px 5px !important;
    font-size: 11px !important;
  }

  .aside-bottom {
    padding: 11px !important;
    border-radius: 12px !important;
  }

  .aside-bottom b {
    font-size: 12px !important;
  }

  .aside-bottom .sub {
    font-size: 10px !important;
  }

  .sidebar-foot {
    font-size: 10px !important;
  }
}

/* ---------- HEADER ---------- */

.top {
  min-height: 59px !important;
  padding: 10px 20px !important;
  gap: 10px !important;
}

.top-title {
  font-size: 13px !important;
}

.top-meta {
  font-size: 10px !important;
  margin-top: 3px !important;
}

.top-right {
  gap: 7px !important;
}

.top .tag {
  padding: 6px 9px !important;
  font-size: 10px !important;
}

.top .logout-btn {
  padding: 7px 10px !important;
  font-size: 11px !important;
}

/* ---------- AREA PERCAKAPAN ---------- */

.chat {
  min-height: 0 !important;
  padding: 15px 25px !important;
  overflow-y: auto !important;
}

.msg {
  margin: 14px auto !important;
  max-width: 790px !important;
  gap: 11px !important;
}

.avatar {
  width: 30px !important;
  height: 30px !important;
  border-radius: 9px !important;
  font-size: 17px !important;
}

.bubble {
  font-size: 13px !important;
  line-height: 1.65 !important;
}

.assistant .bubble {
  line-height: 1.65 !important;
}

.assistant .bubble p {
  margin: 0 0 9px !important;
}

.assistant .bubble h1 {
  font-size: 19px !important;
  margin: 15px 0 8px !important;
}

.assistant .bubble h2 {
  font-size: 16px !important;
  margin: 14px 0 7px !important;
}

.assistant .bubble h3 {
  font-size: 14px !important;
  margin: 12px 0 6px !important;
}

.assistant .bubble ul,
.assistant .bubble ol {
  margin: 8px 0 11px !important;
  padding-left: 21px !important;
}

.assistant .bubble li {
  margin-bottom: 3px !important;
}

.assistant .bubble blockquote {
  padding: 7px 12px !important;
  margin: 9px 0 !important;
}

.assistant .bubble pre {
  padding: 12px !important;
  border-radius: 9px !important;
}

.assistant .bubble pre code {
  font-size: 11px !important;
}

.assistant .bubble table {
  font-size: 11px !important;
}

.assistant .bubble th,
.assistant .bubble td {
  padding: 7px 9px !important;
}

.assistant .bubble hr {
  margin: 14px 0 !important;
}

.user .bubble {
  padding: 9px 13px !important;
  border-radius: 13px 13px 4px 13px !important;
}

/* ---------- INTRO ---------- */

.intro {
  margin-top: clamp(25px, 7vh, 75px) !important;
}

.intro-symbol {
  width: 53px !important;
  height: 53px !important;
  font-size: 27px !important;
  border-radius: 16px !important;
  margin-bottom: 19px !important;
}

.intro h1 {
  font-size: clamp(24px, 3vw, 33px) !important;
}

.intro p {
  font-size: 12px !important;
}

.suggestions {
  margin-top: 23px !important;
  gap: 8px !important;
}

.suggest {
  padding: 10px 12px !important;
  min-height: 56px !important;
  font-size: 11px !important;
  border-radius: 10px !important;
}

.suggest b {
  font-size: 11px !important;
}

/* ---------- COMPOSER ---------- */

.composer {
  padding: 5px 15px 10px !important;
  flex-shrink: 0 !important;
}

.composer .inner {
  max-width: 880px !important;
  padding: 10px 12px !important;
  border-radius: 15px !important;
}

.composer .inner textarea {
  min-height: 42px !important;
  max-height: 130px !important;
  font-size: 13px !important;
  line-height: 1.5 !important;
}

.composer .actions {
  margin-top: 5px !important;
}

.composer .btn {
  padding: 7px 11px !important;
  font-size: 11px !important;
  border-radius: 9px !important;
}

.composer .note,
.note {
  font-size: 10px !important;
  margin-top: 6px !important;
}

.composer-left {
  gap: 7px !important;
}

.hint {
  font-size: 10px !important;
}

/* ---------- ATTACHMENTS ---------- */

.attachment-tray {
  gap: 7px !important;
  margin-bottom: 8px !important;
}

.attachment-card {
  padding: 6px !important;
  border-radius: 10px !important;
}

.attachment-card img,
.attachment-file-icon {
  width: 39px !important;
  height: 39px !important;
}

.attachment-name {
  font-size: 11px !important;
}

.attachment-meta {
  font-size: 9px !important;
}

/* ---------- TABLET ---------- */

@media (max-width: 800px) {
  .chat {
    padding: 12px 15px !important;
  }

  #cp-enhance .cp-skills {
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    scrollbar-width: thin;
    padding-bottom: 4px;
  }

  #cp-enhance .cp-skill {
    flex-shrink: 0 !important;
  }

  .composer {
    padding: 5px 10px 9px !important;
  }

  .assistant .bubble {
    font-size: 12.5px !important;
  }
}

/* ---------- MOBILE ---------- */

@media (max-width: 540px) {
  .top {
    min-height: 54px !important;
    padding: 9px 12px !important;
  }

  .top-title {
    font-size: 12px !important;
  }

  #cp-enhance {
    margin: 3px auto 5px !important;
  }

  #cp-enhance .cp-head {
    gap: 5px;
    margin-bottom: 5px;
  }

  #cp-enhance .cp-eyebrow,
  #cp-enhance .cp-active {
    font-size: 9px;
  }

  #cp-enhance .cp-skill {
    padding: 6px 8px !important;
    font-size: 10px !important;
  }

  #cp-enhance .cp-sub {
    font-size: 9px !important;
  }

  .chat {
    padding: 10px 12px !important;
  }

  .msg {
    gap: 8px !important;
    margin: 12px auto !important;
  }

  .avatar {
    width: 27px !important;
    height: 27px !important;
  }

  .composer {
    padding: 4px 9px 8px !important;
  }

  .composer .inner {
    padding: 8px 10px !important;
    border-radius: 13px !important;
  }

  .composer .inner textarea {
    min-height: 40px !important;
    font-size: 12px !important;
  }

  .composer .btn {
    padding: 7px 9px !important;
    font-size: 10px !important;
  }

  #cp-settings-launch:not(.cp-settings-inline) {
    top: auto;
    bottom: 14px;
    right: 14px;
  }

  #cp-settings-panel {
    padding: 17px;
    width: 94vw;
  }
}

/* ---------- ACCESSIBILITY ---------- */

@media (prefers-reduced-motion: reduce) {
  #cp-enhance .cp-skill {
    transition: none !important;
  }

  #cp-enhance .cp-skill:hover {
    transform: none !important;
  }
}


/* ============================================
   CLAUDEPRO MOBILE PREMIUM V3
   Tampilan HP lebih rapi dan ringan
   ============================================ */

@media (max-width: 540px) {

  /* LAYOUT UTAMA */
  html, body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  .app {
    width: 100%;
    height: 100dvh;
    min-height: 0 !important;
    overflow: hidden;
  }

  main {
    min-width: 0;
    min-height: 0;
    flex: 1;
    overflow: hidden;
  }

  /* HEADER */
  .top {
    min-height: 56px !important;
    padding: 8px 10px !important;
    gap: 7px !important;
  }

  .top > div:first-child {
    min-width: 0;
    flex: 1;
  }

  .top-title {
    font-size: 12px !important;
    white-space: nowrap;
  }

  .top-meta {
    font-size: 9px !important;
    white-space: nowrap;
  }

  .top-right {
    display: flex !important;
    align-items: center;
    flex-shrink: 0;
    gap: 5px !important;
  }

  .top .logout-btn {
    font-size: 10px !important;
    padding: 7px 8px !important;
    white-space: nowrap;
  }

  .top .tag {
    display: none !important;
  }

  /* PENGATURAN DI HEADER */
  #cp-settings-launch,
  #cp-settings-launch.cp-settings-inline {
    position: static !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 34px !important;
    height: 34px !important;
    padding: 0 !important;
    margin: 0 !important;
    flex-shrink: 0;
    font-size: 0 !important;
    border-radius: 10px !important;
    box-shadow: none !important;
    z-index: auto !important;
  }

  #cp-settings-launch::before {
    content: "\2699";
    font-size: 19px;
    line-height: 1;
    font-weight: normal;
  }

  /* AREA CHAT LEBIH LUAS */
  .chat {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    padding: 12px 14px 18px !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    overscroll-behavior: contain;
  }

  .msg {
    max-width: 100% !important;
    margin: 13px auto !important;
    gap: 9px !important;
  }

  .assistant .bubble {
    font-size: 13px !important;
    line-height: 1.7 !important;
  }

  .assistant .bubble h1 {
    font-size: 18px !important;
  }

  .assistant .bubble h2 {
    font-size: 15px !important;
  }

  .assistant .bubble h3 {
    font-size: 13px !important;
  }

  .assistant .bubble p {
    margin-bottom: 9px !important;
  }

  .assistant .bubble ul,
  .assistant .bubble ol {
    padding-left: 21px !important;
  }

  .assistant .bubble pre,
  .assistant .bubble .table-scroll {
    max-width: 100%;
    overflow-x: auto !important;
  }

  /* AREA MENGETIK */
  .composer {
    flex: 0 0 auto !important;
    min-width: 0;
    padding: 8px 10px max(10px, env(safe-area-inset-bottom)) !important;
    background: #0e1015 !important;
    border-top: 1px solid #292b33;
  }

  /* SKILL AI */
  #cp-enhance,
  .composer #cp-enhance {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 0 8px !important;
    padding: 0 !important;
    border: none !important;
    background: transparent !important;
  }

  #cp-enhance .cp-head {
    margin: 0 0 7px !important;
  }

  #cp-enhance .cp-eyebrow {
    font-size: 10px !important;
    letter-spacing: .08em !important;
  }

  #cp-enhance .cp-active,
  #cp-enhance .cp-sub {
    display: none !important;
  }

  #cp-enhance .cp-skills {
    display: flex !important;
    flex-wrap: nowrap !important;
    gap: 6px !important;
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    scrollbar-width: none !important;
    -webkit-overflow-scrolling: touch;
    padding: 1px 2px 4px !important;
  }

  #cp-enhance .cp-skills::-webkit-scrollbar {
    display: none !important;
  }

  #cp-enhance .cp-skill {
    flex: 0 0 auto !important;
    padding: 8px 10px !important;
    border-radius: 11px !important;
    font-size: 11px !important;
    line-height: 1.2 !important;
    white-space: nowrap !important;
    transform: none !important;
  }

  #cp-enhance .cp-skill[aria-pressed="true"] {
    box-shadow: 0 2px 8px #d7825c33;
  }

  /* KOTAK INPUT */
  .composer .inner {
    width: 100%;
    max-width: 100% !important;
    padding: 10px 11px !important;
    border-radius: 15px !important;
    background: #1a1d26 !important;
  }

  .composer .inner textarea {
    display: block;
    width: 100%;
    min-height: 38px !important;
    max-height: 105px !important;
    font-size: 13px !important;
    line-height: 1.5 !important;
    padding: 2px 0 !important;
  }

  .composer .actions {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    gap: 7px !important;
    margin-top: 6px !important;
  }

  .composer-left {
    min-width: 0;
  }

  .composer .btn {
    font-size: 11px !important;
    padding: 8px 11px !important;
    border-radius: 10px !important;
    white-space: nowrap;
  }

  .composer .btn.primary {
    padding: 8px 13px !important;
    flex-shrink: 0;
  }

  .composer .hint,
  .composer .note {
    display: none !important;
  }

  /* LAMPIRAN */
  .attachment-tray {
    max-height: 100px !important;
    overflow-y: auto;
  }

  .attachment-card {
    min-width: 0 !important;
    max-width: 100% !important;
  }

  /* MODAL SETTINGS */
  #cp-settings-shade {
    position: fixed;
    inset: 0;
    z-index: 9998;
  }

  #cp-settings-panel {
    position: fixed !important;
    top: auto !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    transform: none !important;
    width: 100% !important;
    max-height: min(80dvh, 580px) !important;
    overflow-y: auto !important;
    padding: 22px 18px max(24px, env(safe-area-inset-bottom)) !important;
    border-radius: 22px 22px 0 0 !important;
    border-bottom: 0 !important;
  }

  #cp-settings-panel h2 {
    font-size: 18px !important;
  }

  #cp-settings-panel select {
    font-size: 14px !important;
    min-height: 43px;
  }

  #cp-settings-panel .cp-footer button {
    min-height: 40px;
  }
}

/* HP SANGAT KECIL */
@media (max-width: 380px) {
  .top-title {
    font-size: 11px !important;
  }

  .top-meta {
    display: none !important;
  }

  .top .logout-btn {
    padding: 7px !important;
    font-size: 9px !important;
  }

  #cp-enhance .cp-skill {
    font-size: 10px !important;
    padding: 7px 9px !important;
  }

  .chat {
    padding-left: 11px !important;
    padding-right: 11px !important;
  }
}


/* FIX TOMBOL SETTINGS HILANG DI HP */

@media (max-width: 540px) {
  .top-right {
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    flex-shrink: 0 !important;
  }

  #cp-settings-launch {
    display: inline-flex !important;
    position: static !important;
    visibility: visible !important;
    opacity: 1 !important;

    align-items: center !important;
    justify-content: center !important;

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

    padding: 0 !important;
    margin: 0 !important;

    font-size: 0 !important;
    line-height: 1 !important;

    background: #292a32 !important;
    color: #f5eee9 !important;
    border: 1px solid #4b4750 !important;
    border-radius: 10px !important;

    box-shadow: none !important;
    z-index: 10 !important;
  }

  #cp-settings-launch::before {
    content: "⚙" !important;
    display: block !important;
    font-size: 21px !important;
    color: #f5eee9 !important;
  }

  #cp-settings-launch[hidden] {
    display: none !important;
  }
}

/* ============================================
   FIX SIDEBAR MOBILE — INFO AKUN TIDAK KEPOTONG
   ============================================ */

@media (max-width: 540px) {
  /* panel sidebar mobile */
  aside {
    display: flex !important;
    flex-direction: column !important;
    justify-content: flex-start !important;

    height: 100dvh !important;
    max-height: 100dvh !important;
    min-height: 100dvh !important;

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

    padding: 18px 16px calc(34px + env(safe-area-inset-bottom)) !important;
    box-sizing: border-box !important;
    -webkit-overflow-scrolling: touch !important;
  }

  /* biar konten atas tidak terlalu mepet */
  .brand {
    margin-bottom: 8px !important;
  }

  .brand-caption {
    display: block !important;
    margin-left: 58px !important;
    margin-bottom: 10px !important;
  }

  .nav-group {
    margin-top: 16px !important;
    flex: 0 0 auto !important;
  }

  .nav {
    min-height: 54px !important;
    padding: 12px 14px !important;
    border-radius: 14px !important;
  }

  /* bagian daftar percakapan */
  .thread-section {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    margin: 16px 0 14px !important;
    overflow: visible !important;
  }

  .thread-head {
    padding: 6px 2px 8px !important;
  }

  .thread-open {
    min-height: 52px !important;
    padding: 10px 12px !important;
    border-radius: 14px !important;
  }

  /* kartu info akun / paket */
  .aside-bottom {
    flex-shrink: 0 !important;
    margin-top: 14px !important;
    margin-bottom: 12px !important;
    padding: 14px 14px 16px !important;
    border-radius: 18px !important;
    position: relative !important;
    bottom: auto !important;
  }

  .aside-bottom b,
  .aside-bottom strong {
    display: block !important;
    font-size: 14px !important;
    line-height: 1.35 !important;
    margin-bottom: 8px !important;
  }

  .aside-bottom .sub,
  .aside-bottom small,
  .aside-bottom span {
    font-size: 11px !important;
    line-height: 1.5 !important;
    word-break: break-word !important;
  }

  /* footer bawah sidebar */
  .sidebar-foot {
    flex-shrink: 0 !important;
    margin-top: 2px !important;
    padding-bottom: calc(8px + env(safe-area-inset-bottom)) !important;
    font-size: 11px !important;
    line-height: 1.45 !important;
    word-break: break-word !important;
  }

  /* kalau ada wrapper menu mobile */
  .mobile-sidebar,
  .sidebar-drawer,
  .sidebar-panel {
    height: 100dvh !important;
    max-height: 100dvh !important;
    overflow: hidden !important;
  }
}


/* ==========================================
   CLAUDEPRO — HISTORY SCROLL MOBILE V4
   Riwayat scroll sendiri, akun tetap terlihat
   ========================================== */

@media (max-width: 540px) {

  /* Sidebar menjadi layout vertikal */
  aside {
    display: flex !important;
    flex-direction: column !important;
    flex-wrap: nowrap !important;

    height: 100dvh !important;
    max-height: 100dvh !important;
    min-height: 0 !important;

    overflow: hidden !important;
    padding: 16px 14px
      calc(16px + env(safe-area-inset-bottom)) !important;
  }

  /* Logo dan menu tidak ikut scroll */
  aside > :first-child,
  aside .nav-group {
    flex: 0 0 auto !important;
  }

  aside .nav-group {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    margin-top: 16px !important;
    gap: 5px !important;
  }

  aside .nav {
    width: 100% !important;
    justify-content: flex-start !important;
  }

  aside .nav .nav-text,
  aside .nav-label {
    display: inline !important;
  }

  /* Matikan spacer yang memakan ruang */
  aside .sidebar-spacer {
    display: none !important;
  }

  /* HISTORY — AREA SCROLL SENDIRI */
  aside .thread-section {
    display: flex !important;
    flex-direction: column !important;

    flex: 1 1 auto !important;
    min-height: 80px !important;
    max-height: none !important;

    margin: 16px 0 10px !important;

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

    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;

    scrollbar-width: thin;
    scrollbar-color: #58505a transparent;
  }

  /* Judul riwayat tetap di atas */
  aside .thread-head {
    position: sticky !important;
    top: 0;
    z-index: 2;
    flex-shrink: 0 !important;
    background: #12151d;
    padding: 10px 4px !important;
  }

  aside .thread-list {
    display: flex !important;
    flex-direction: column !important;
    flex: 0 0 auto !important;
    gap: 4px !important;
  }

  aside .thread-entry {
    flex: 0 0 auto !important;
  }

  aside .thread-open {
    min-width: 0 !important;
    min-height: 38px !important;
    padding: 9px 6px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  /* Informasi akun tetap di bawah */
  aside .aside-bottom {
    flex: 0 0 auto !important;
    margin: 8px 0 !important;
    padding: 12px !important;
    position: static !important;
  }

  aside .sidebar-foot {
    display: block !important;
    flex: 0 0 auto !important;
    margin-top: 5px !important;
    padding-bottom: 4px !important;
  }
}
