/*
 * 좁은 화면 상단바 — 로고 마크와 메뉴(햄버거) 버튼을 같은 크기 · 같은 모서리로.
 * 템플릿의 .btn-icon 은 약 37.5px · 6px 모서리, 로고 마크는 30px · 8px 이라
 * 나란히 서면 크기와 각이 어긋나 보였다. 둘 다 36px · 8px 로 맞추고 세로 가운데에 둔다.
 */
.app-topbar .sidenav-toggle-button {
    width: 36px;
    height: 36px;
    border-radius: 8px;
}
.app-topbar .sidenav-toggle-button svg {
    width: 20px;
    height: 20px;
}
.logo-topbar {
    line-height: normal;
}
.logo-topbar a {
    line-height: 0;
}
/* 대시보드 — 앱 탭(.app-nav-link.active)과 같은 파란 밑줄을 로고 글자 폭만큼 긋는다(로고 칸은 사이드바 폭이라 넓다). */
.logo-topbar-inner {
    display: inline-flex;
    align-items: center;
    height: 100%;
    border-top: 3px solid transparent;
    border-bottom: 3px solid transparent;
}
.logo-topbar.is-active .logo-topbar-inner {
    border-bottom-color: var(--hospital-blue);
}
.logo-topbar .mf-brand-mark {
    width: 36px;
    height: 36px;
    border-radius: 8px;
}
.logo-topbar .mf-brand-mark svg {
    width: 20px;
    height: 20px;
}

/*
 * ▦ 전체 앱 — 좁은 화면(992px 미만)에서는 화면 전체를 덮는 판(offcanvas)이다.
 * 상단바 밖에 둔다: 상단바 안의 드롭다운을 fixed 로 펼치면 상단바가 기준 상자가 되어
 * 화면 전체를 덮지 못했다. 넓은 화면에서는 지금처럼 작은 드롭다운(.app-grid-menu)이다.
 */
.app-grid-panel {
    /* 좁은 화면에서만 열린다. 내 정보 · 알림 판처럼 오른쪽에서 밀려 나와 화면 전체를 덮는다. */
    --theme-offcanvas-width: 100vw;
    background: var(--theme-body-bg);
}
.app-grid-panel .offcanvas-body {
    padding: 0 1rem calc(1rem + env(safe-area-inset-bottom));
}
.app-grid-panel .app-grid-group {
    padding: 1rem 0.25rem 0.5rem;
    font-size: 0.8125rem;
}
.app-grid-panel .app-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    margin-bottom: 0;
}
.app-grid-panel .app-grid-item {
    padding: 1rem 0.25rem;
    border: 1px solid var(--theme-border-color);
    border-radius: 0.75rem;
    background: var(--theme-secondary-bg);
    font-size: 0.875rem;
}
.app-grid-panel .app-grid-item svg {
    width: 1.75rem;
    height: 1.75rem;
}
.app-grid-panel .app-grid-item.active {
    border-color: var(--hospital-blue);
}

/* 화면을 덮는 판(전체 앱 · 내 정보)의 머리: 제목 왼쪽, 닫기 오른쪽 */
.app-grid-panel .offcanvas-header,
.user-panel .offcanvas-header,
.notification-panel .offcanvas-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--theme-topbar-height);
    border-bottom: 1px solid var(--theme-border-color);
    background: var(--theme-secondary-bg);
}
.app-grid-panel .offcanvas-title,
.user-panel .offcanvas-title,
.notification-panel .offcanvas-title {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 700;
}

/* ==========================================================================
 * 내 정보 판 — 상단바의 이름을 누르면 오른쪽에서 밀려 나온다.
 * 좁은 화면에서는 화면 전체, 넓은 화면에서는 360px.
 * ========================================================================== */
button.topbar-user {
    border: 0;
    background: none;
}
/* 넓은 화면 내 메뉴의 이름 앞 작은 사진 */
.topbar-user .topbar-user-face {
    width: 1.75rem;
    height: 1.75rem;
    font-size: 0.75rem;
}
/* 좁은 화면의 내 정보 버튼 — 사진 동그라미만(32px + 둘레 4px = 손가락 40px) */
.topbar-user.topbar-user-avatar {
    padding: 0.25rem;
    border-radius: 50%;
}
/* 판(내 정보)을 닫으면 부트스트랩이 이 버튼에 포커스를 돌려준다 — 마우스 · 터치로 생긴 포커스와
   터치 기기에 남는 hover 에는 진하게 하지 않는다(overrides.css 의 :focus · :hover 배경). 키보드 포커스 · 열린 동안만 진하게. */
.topbar-user:focus:not(:focus-visible):not(.show) {
    background: none;
}
@media (hover: none) {
    .topbar-user:hover:not(:focus-visible):not(.show) {
        background: none;
    }
}
.user-panel {
    /* 좁은 화면에서만 열린다(넓은 화면은 드롭다운). 화면 전체를 덮는다. */
    --theme-offcanvas-width: 100vw;
    background: var(--theme-body-bg);
}
.user-panel-profile {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 1.25rem 1rem;
    background: var(--theme-secondary-bg);
}
.user-panel-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--hospital-blue);
    color: #fff;
    font-size: 1.375rem;
    font-weight: 700;
}
.user-panel-name {
    font-size: 1.0625rem;
    font-weight: 700;
}
.min-w-0 {
    min-width: 0;
}
.user-panel-meta {
    padding: 0.625rem 1rem;
    border-top: 1px solid var(--theme-border-color);
    border-bottom: 1px solid var(--theme-border-color);
    background: var(--theme-secondary-bg);
    font-size: 0.8125rem;
    color: var(--theme-secondary-color);
}
.user-panel-links {
    margin-top: 0.75rem;
    border-top: 1px solid var(--theme-border-color);
    border-bottom: 1px solid var(--theme-border-color);
}
.user-panel-links .list-group-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    background: var(--theme-secondary-bg);
}
.user-panel-links .list-group-item svg {
    color: var(--theme-secondary-color);
}
.user-panel-logout {
    padding: 1rem;
}

/* 화면을 덮는 판(전체 앱 · 내 정보)의 닫기 — 면·테두리 없이 X 만 */
.panel-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    margin-right: -0.5rem;
    padding: 0;
    border: 0;
    background: none;
    color: var(--theme-body-color);
}
.panel-close svg {
    width: 22px;
    height: 22px;
}
.panel-close:focus-visible {
    outline: 2px solid var(--hospital-blue);
    outline-offset: 2px;
    border-radius: 6px;
}

/* ==========================================================================
 * 알림 판 — 좁은 화면에서 종을 누르면 오른쪽에서 밀려 나와 화면을 덮는다.
 * 한 줄: 종류 아이콘 · 꼬리표와 시간 · 제목 · 내용 한 줄 · 안 읽음 점.
 * ========================================================================== */
.notification-panel {
    --theme-offcanvas-width: 100vw;
    background: var(--theme-body-bg);
}
.notification-panel .offcanvas-body {
    background: var(--theme-secondary-bg);
}
.notification-row {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.875rem 2rem 0.875rem 1rem;
    border-bottom: 1px solid var(--theme-border-color);
    color: var(--theme-body-color);
    text-decoration: none;
}
.notification-row:active,
.notification-row:hover {
    background: var(--theme-primary-bg-subtle);
    color: var(--theme-body-color);
}
.notification-row.is-unread {
    background: rgba(0, 137, 205, 0.05);
}
.notification-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
}
.notification-icon svg {
    width: 18px;
    height: 18px;
}
.notification-icon.tone-primary { background: var(--theme-primary-bg-subtle); color: var(--brand-emph); }
.notification-icon.tone-success { background: var(--st-success-row); color: var(--st-success); }
.notification-icon.tone-danger { background: var(--st-danger-row); color: var(--st-danger); }
.notification-icon.tone-warning { background: var(--st-warning-row); color: var(--st-warning); }
.notification-icon.tone-info { background: var(--st-info-row); color: var(--st-info); }
.notification-icon.tone-secondary { background: var(--sf-raised); color: var(--theme-secondary-color); }
.notification-content {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
}
.notification-tags {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem;
    margin-bottom: 0.125rem;
}
.notification-tag {
    padding: 0 0.375rem;
    border-radius: 4px;
    background: var(--sf-raised);
    color: var(--theme-secondary-color);
    font-size: 0.6875rem;
    font-weight: 600;
    line-height: 1.5;
}
.notification-tag.is-urgent {
    background: var(--st-danger-row);
    color: var(--st-danger);
}
.notification-time {
    margin-left: auto;
    color: var(--theme-secondary-color);
    font-size: 0.75rem;
    white-space: nowrap;
}
.notification-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.notification-row.is-unread .notification-title {
    font-weight: 700;
}
.notification-body {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--theme-secondary-color);
    font-size: 0.8125rem;
}
.notification-unread-dot {
    position: absolute;
    top: 50%;
    right: 0.875rem;
    width: 8px;
    height: 8px;
    margin-top: -4px;
    border-radius: 50%;
    background: var(--hospital-blue);
}
.notification-empty {
    padding: 4rem 1rem;
    text-align: center;
}
.notification-empty svg {
    width: 2.5rem;
    height: 2.5rem;
    color: var(--theme-secondary-color);
}
.notification-panel-foot {
    padding: 0.75rem 1rem calc(0.75rem + env(safe-area-inset-bottom));
    border-top: 1px solid var(--theme-border-color);
    background: var(--theme-secondary-bg);
}

