/* ============================================================
   우측 사이드바
============================================================ */
#side { flex-shrink:0; }

.right-sidebar.portal-sidebar {
  position:fixed;
  top:120px;
  right:0;
  width:260px;
  max-height:calc(100dvh - 140px);
  padding:0 0 20px;
  box-sizing:border-box;
  overflow-x:hidden;
  overflow-y:auto;
  opacity:1;
  visibility:visible;
  pointer-events:auto;
  transform:translateX(0);
  z-index:9000;
  transition:transform .25s ease, opacity .2s ease, visibility .2s ease;
  scrollbar-width:thin;
  scrollbar-color:#cbd5e1 transparent;
}
.right-sidebar.portal-sidebar::-webkit-scrollbar { width:5px; }
.right-sidebar.portal-sidebar::-webkit-scrollbar-track { background:transparent; }
.right-sidebar.portal-sidebar::-webkit-scrollbar-thumb { background:#cbd5e1; border-radius:999px; }
.right-sidebar.portal-sidebar.sidebar-open { transform:translateX(0); opacity:1; visibility:visible; pointer-events:auto; }
.right-sidebar.portal-sidebar.sidebar-closed { transform:translateX(100%); opacity:0; visibility:hidden; pointer-events:none; }

/* ============================================================
   공통 사이드바 카드
============================================================ */
.right-sidebar .sidebar-section {
  width:100%;
  min-width:0;
  max-width:100%;
  margin:0 0 6px;
  padding:14px;
  overflow:hidden;
  box-sizing:border-box;
  background:#fff;
  border:1px solid #eef0f3;
  border-radius:14px;
  box-shadow:0 4px 14px rgba(0,0,0,.06);
}
.right-sidebar .sidebar-section:last-child { margin-bottom:0; }
.right-sidebar .sidebar-title { margin:0 0 12px; color:#1e293b; font-size:16px; font-weight:700; line-height:1.4; }
.right-sidebar .auth-box { display:flex; flex-direction:column; gap:9px; }

/* ============================================================
   로그인
============================================================ */
.right-sidebar .app-input {
  display:block; width:100%; height:42px; margin:0; padding:0 12px;
  box-sizing:border-box; color:#111827; font-family:inherit; font-size:13px;
  background:#fff; border:1px solid #dfe3e8; border-radius:8px; outline:none;
  transition:border-color .18s ease, box-shadow .18s ease;
}
.right-sidebar .app-input::placeholder { color:#9ca3af; }
.right-sidebar .app-input:focus { border-color:#4aa8ff; box-shadow:0 0 0 3px rgba(74,168,255,.1); }
.right-sidebar .app-btn-primary,
.right-sidebar .app-btn-secondary {
  width:100%; min-height:40px; margin:0; padding:9px 12px; box-sizing:border-box;
  display:flex; align-items:center; justify-content:center; font-family:inherit;
  font-size:13px; font-weight:600; line-height:1.4; text-align:center;
  text-decoration:none; border:0; border-radius:8px; cursor:pointer;
  transition:background .18s ease, color .18s ease;
}
.right-sidebar .app-btn-primary { color:#fff; background:#4aa8ff; }
.right-sidebar .app-btn-primary:hover { color:#fff; background:#3698ee; }
.right-sidebar .app-btn-secondary { color:#374151; background:#e5e7eb; }
.right-sidebar .app-btn-secondary:hover { color:#111827; background:#d9dde3; }
.right-sidebar .login-status { min-height:0; margin:0; color:#666; font-size:12px; line-height:1.4; }
.right-sidebar .login-status:empty { display:none; }

.right-sidebar .sidebar-user-profile { display:flex; align-items:center; gap:10px; width:100%; margin:0 0 4px; padding:2px 0 8px; box-sizing:border-box; }
.right-sidebar .sidebar-user-icon { flex:0 0 38px; width:38px; height:38px; display:flex; align-items:center; justify-content:center; box-sizing:border-box; background:#f0f6ff; border:1px solid #e0ecff; border-radius:50%; }
.right-sidebar .sidebar-user-icon svg { width:21px; height:21px; fill:none; stroke:#2684ff; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; }
.right-sidebar .sidebar-user-name { min-width:0; display:flex; align-items:baseline; gap:4px; }
.right-sidebar .sidebar-user-name strong { max-width:120px; overflow:hidden; color:#111827; font-size:15px; font-weight:800; line-height:1.4; white-space:nowrap; text-overflow:ellipsis; }
.right-sidebar .sidebar-user-name span { flex:0 0 auto; color:#949ba7; font-size:11px; font-weight:500; white-space:nowrap; }

/* ============================================================
   체크리스트 카드: 민원109 카드와 동일한 외곽 구조
============================================================ */
.right-sidebar .sidebar-media-card { padding:14px; }
.right-sidebar .sidebar-media-link { display:block; width:100%; min-width:0; margin:0; color:inherit; text-decoration:none; }
.right-sidebar .sidebar-media-box {
  width:100%; min-width:0; margin:0; padding:10px; overflow:hidden; box-sizing:border-box;
  background:#f1f5f9; border-radius:10px;
}
.right-sidebar .sidebar-media-img {
  display:block; width:100%; max-width:100%; height:auto; margin:0 auto;
  object-fit:contain; box-sizing:border-box; border-radius:7px; background:#fff;
}
.right-sidebar .sidebar-media-link:hover .sidebar-media-box { background:#eaf3ff; }
.right-sidebar .sidebar-media-link:focus-visible { outline:2px solid #2684ff; outline-offset:2px; border-radius:10px; }

/* ============================================================
   민원109 광고 배너
============================================================ */
.right-sidebar .ad-banner { padding:14px; }
.right-sidebar .ad-banner-content { margin:0; text-align:left; }
.right-sidebar .ad-price-box { margin:0 0 8px; padding:10px; box-sizing:border-box; background:#f1f5f9; border-radius:10px; }
.right-sidebar .ad-main-text { margin:0 0 7px; color:#1e293b; font-size:14px; font-weight:700; line-height:1.4; }
.right-sidebar .ad-sub-wrap { width:100%; min-width:0; margin:0; overflow:hidden; }
.right-sidebar .notice-banner-img { display:block; width:100%; max-width:100%; height:auto; margin:0; object-fit:contain; box-sizing:border-box; }
.right-sidebar .ad-contact-box { display:block; margin:0; padding:11px 12px; box-sizing:border-box; color:inherit; background:#e2e8f0; border-radius:10px; text-decoration:none; transition:background .18s ease, transform .18s ease; }
.right-sidebar .ad-contact-box:hover { background:#dbeafe; transform:translateY(-1px); }
.right-sidebar .ad-contact-title { display:block; margin:0; color:#0f172a; font-size:13px; font-weight:700; line-height:1.4; }
.right-sidebar .ad-contact-phone { display:block; margin:4px 0 0; color:#4aa8ff; font-size:15px; font-weight:800; line-height:1.4; }

/* ============================================================
   사이드바 토글
============================================================ */
.tablet-sidebar-toggle {
  position:fixed; top:145px; right:260px; width:42px; min-height:112px;
  padding:10px 6px; box-sizing:border-box; display:flex; flex-direction:column;
  align-items:center; justify-content:center; gap:7px; color:#fff; font-family:inherit;
  background:#4aa8ff; border:0; border-radius:10px 0 0 10px;
  box-shadow:-3px 3px 12px rgba(37,99,235,.18); cursor:pointer; z-index:9001;
  transition:right .25s ease, background .18s ease, box-shadow .18s ease;
}
.tablet-sidebar-toggle:hover { background:#318fec; }
.tablet-sidebar-toggle-text { writing-mode:vertical-rl; text-orientation:mixed; white-space:nowrap; font-size:11px; font-weight:700; line-height:1.35; }
.tablet-sidebar-toggle-icon { font-size:20px; line-height:1; }
.tablet-sidebar-toggle:not(.active) { right:0; }
.tablet-sidebar-toggle.active { right:260px; }

/* ============================================================
   태블릿 769px ~ 1024px
============================================================ */
@media (min-width:769px) and (max-width:1024px) {
  #side { display:block !important; }
  .right-sidebar.portal-sidebar {
    top:110px; width:250px; max-height:calc(100dvh - 130px); padding:10px;
    background:#f8fafc; border:1px solid #e5e7eb; border-right:0;
    border-radius:14px 0 0 14px; box-shadow:-5px 6px 20px rgba(15,23,42,.12);
  }
  .right-sidebar.portal-sidebar:not(.sidebar-open) { transform:translateX(100%); opacity:0; visibility:hidden; pointer-events:none; }
  .right-sidebar.portal-sidebar.sidebar-open { transform:translateX(0); opacity:1; visibility:visible; pointer-events:auto; }
  .tablet-sidebar-toggle { top:145px; right:0; }
  .tablet-sidebar-toggle:not(.active) { right:0; }
  .tablet-sidebar-toggle.active { right:250px; }
  .right-sidebar .sidebar-section { margin-bottom:6px; padding:12px; border-radius:12px; }
  .right-sidebar .sidebar-title { margin-bottom:10px; font-size:14px; }
  .right-sidebar .auth-box { gap:8px; }
  .right-sidebar .app-input { height:38px; padding:0 10px; font-size:13px; }
  .right-sidebar .app-btn-primary,
  .right-sidebar .app-btn-secondary { min-height:38px; padding:8px 10px; font-size:13px; }
  .right-sidebar .sidebar-media-box { padding:8px; border-radius:9px; }
  .right-sidebar .ad-price-box { margin-bottom:8px; padding:10px; }
  .right-sidebar .ad-contact-box { padding:10px; }
}

/* ============================================================
   모바일
============================================================ */
@media (max-width:768px) {
  #side { display:none !important; }
  .right-sidebar.portal-sidebar,
  .tablet-sidebar-toggle { display:none !important; }
}

/* ============================================================
   FINAL MINWON109 BOTTOM SCROLL SPACE
============================================================ */
.right-sidebar .ad-banner:last-child {
  margin-bottom: 24px !important;
}

.right-sidebar.portal-sidebar {
  padding-bottom: 24px !important;
  scroll-padding-bottom: 72px !important;
}

@media (min-width: 769px) and (max-width: 1024px) {
  .right-sidebar .ad-banner:last-child {
    margin-bottom: 24px !important;
  }

  .right-sidebar.portal-sidebar {
    padding-bottom: 20px !important;
    scroll-padding-bottom: 60px !important;
  }
}
