:root {
    --nav-h: 60px;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: var(--nav-h -20px)
}

[id] {
    scroll-margin-top: var(--nav-h)
}

body {
    padding-top: var(--nav-h)
}

section {
    padding: 0px;
}

main {
    margin-left: 200px;
    overflow-y: auto;
}

table {
    table-layout: fixed;
    width: 100%;
}

a,
p,
span,
label,
div,
table,
.btn,
.col-form-label,
th,
td,
li,
.form-control,
.form-select,
.form-text,
.fs-6 {
    color: #3c3c3c;
    font-size: 15px;
    font-weight: 500 !important;
    text-decoration: none !important;
    margin-bottom: .25rem;
}

.login-card {
    margin-top: -120px !important;
}

.text-light {
    color: #5d5c5c !important;
}

/* 讓btn被點擊時不會變成有外框 */
.btn:focus,
.btn:active {
    outline: none !important;
    box-shadow: none !important;
    -webkit-box-shadow: none !important;
}

a:hover {
    color: #5d5c5c;
}

.alert {
    z-index: 2000;
    margin-bottom: 0.2rem;
}

.offcanvas {
    width: 250px;
}

.offcanvas .offcanvas-body {
    flex-grow: 0;
}

.border,
.border-top,
.border-bottom,
.border-start,
.border-end {
    box-shadow: 0 1px 4px 0 rgba(74, 74, 78, .12);
}

/* 限定 .sidebar */
.sidebar {
    scrollbar-width: thin;
}

.sidebar::-webkit-scrollbar {
    width: 8px;
}

.sidebar button {
    padding-top: 0px;
    padding-bottom: 0px;
}

/* === 通用連結間距（不分層級）=== */
.sidebar .sidebar-link,
.sidebar .sidebar-sub-link,
.sidebar .btn-toggle {
    padding: 0px;
    padding-top: 0.25rem;
    font-weight: 600;
    font-size: 14px;
}

/* === 第一層：可收合按鈕（有箭頭）=== */
.btn-toggle {
    background: transparent;
    border: 0;
    display: flex;
    align-items: center;
    width: 100%;
    padding-left: .5rem;
}

/* 箭頭：收合→右、展開→下 */
.btn-toggle::before {
    content: "";
    width: .9rem;
    height: .9rem;
    margin-right: .5rem;
    flex: 0 0 .9rem;
    background-repeat: no-repeat;
    background-size: .9rem .9rem;
    background-position: center;
    display: inline-block;
    transform: rotate(0deg);
    transition: transform .2s ease;
    background-image: url("data:image/svg+xml;utf8,\<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'>\<polyline points='9 18 15 12 9 6'/></svg>");
}

.btn-toggle[aria-expanded="true"]::before {
    transform: rotate(90deg);
}

/* === 第一層：純連結（無箭頭）=== */
.sidebar .sidebar-link {
    display: flex;
    align-items: center;
    text-decoration: none;
    border-radius: .375rem;
    padding-left: .5rem;
}

.sidebar .sidebar-link::before {
    content: "";
    width: .9rem;
    height: .9rem;
    margin-right: .5rem;
    flex: 0 0 .9rem;
    display: inline-block;
}

.sidebar li {
    padding: 0px;
}

/* === 第二層及更深層：再右移 === */
.sidebar .sidebar-sub-link {
    font-weight: 400;
    font-size: 14px;
    display: flex;
    align-items: center;
    text-decoration: none;
    border-radius: .375rem;
    padding-left: 2rem !important;
}

#top-alert-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 9999;
    pointer-events: none;
    display: flex;
    flex-direction: column-reverse;
    align-items: center;
    padding-top: 0px;
    gap: 4px;
}

@media (max-width: 768px) {
    main {
        margin-left: 0px;
    }

    .offcanvas {
        max-width: 50%;
    }
}