.home-dashboard-page {
    --home-card-border: rgba(15, 23, 42, 0.08);
    --home-card-shadow: 0 12px 34px rgba(15, 23, 42, 0.08);
    position: relative;
    min-height: 24rem;
}

[data-bs-theme="dark"] .home-dashboard-page {
    --home-card-border: var(--bs-border-color);
    --home-card-shadow: 0 12px 34px rgba(0, 0, 0, .3);
}

.home-dashboard-loading {
    position: absolute;
    inset: 0;
    z-index: 20;
    min-height: 24rem;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: linear-gradient(180deg, rgba(248, 250, 252, .96), rgba(248, 250, 252, .88));
    transition: opacity .14s ease, visibility .14s ease;
}

.home-dashboard-loading-inner {
    display: inline-flex;
    align-items: center;
    gap: .65rem;
    padding: .75rem 1rem;
    border: 1px solid rgba(15, 23, 42, .08);
    border-radius: .75rem;
    color: #243547;
    background: rgba(255, 255, 255, .94);
    box-shadow: 0 12px 34px rgba(15, 23, 42, .08);
    font-weight: 700;
}

.home-dashboard-loading-inner i {
    color: #0d6efd;
}

[data-bs-theme="dark"] .home-dashboard-loading {
    background: linear-gradient(180deg, rgba(33, 37, 41, .97), rgba(33, 37, 41, .9));
}

[data-bs-theme="dark"] .home-dashboard-loading-inner {
    color: var(--bs-body-color);
    background: var(--gman-surface-raised);
    border-color: var(--bs-border-color);
    box-shadow: var(--home-card-shadow);
}

.home-dashboard-page:not(.is-dashboard-ready) .home-grid {
    visibility: hidden;
    opacity: 0;
}

.home-dashboard-page.is-dashboard-ready .home-grid {
    visibility: visible;
    opacity: 1;
    transition: opacity .14s ease;
}

.home-dashboard-page.is-dashboard-ready .home-dashboard-loading {
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
}

.home-dashboard-page .home-grid {
    min-height: 24rem;
}

.home-dashboard-page .grid-stack-item-content {
    border-radius: .9rem;
    overflow: visible;
    background: transparent;
    box-shadow: none;
}

.dashboard-widget {
    position: relative;
    height: 100%;
    border: 1px solid var(--home-card-border);
    border-radius: .9rem;
    background: #fff;
    box-shadow: var(--home-card-shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

[data-bs-theme="dark"] .dashboard-widget {
    background: var(--gman-surface-raised);
}

.dashboard-widget-header {
    position: absolute;
    top: .6rem;
    right: .6rem;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 0;
    border: 0;
    background: transparent;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .12s ease;
    cursor: default;
    touch-action: none;
}

.dashboard-widget-title {
    display: none;
    align-items: center;
    gap: .45rem;
    font-weight: 600;
    color: #243547;
}

[data-bs-theme="dark"] .dashboard-widget-title {
    color: var(--bs-body-color);
}

.dashboard-header-action {
    min-width: 2.25rem;
    min-height: 2.25rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, .9);
    box-shadow: 0 4px 12px rgba(15, 23, 42, .12);
    touch-action: manipulation;
}

.dashboard-widget-actions {
    display: inline-flex;
    align-items: center;
    gap: .25rem;
    pointer-events: auto;
}

.dashboard-widget-close {
    width: 2.25rem;
    height: 2.25rem;
    display: none;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: .5rem;
    color: #64748b;
    background: rgba(255, 255, 255, .9);
    box-shadow: 0 4px 12px rgba(15, 23, 42, .12);
    touch-action: manipulation;
}

.dashboard-widget-close:hover,
.dashboard-widget-close:focus {
    color: #dc3545;
    background: rgba(220, 53, 69, .08);
}

[data-bs-theme="dark"] .dashboard-header-action,
[data-bs-theme="dark"] .dashboard-widget-close {
    color: var(--bs-secondary-color);
    background: color-mix(in srgb, var(--gman-surface-raised) 92%, transparent);
    border-color: var(--bs-border-color);
    box-shadow: 0 4px 12px rgba(0, 0, 0, .28);
}

.dashboard-widget-body {
    padding: .9rem;
    overflow: auto;
    flex: 1 1 auto;
}

.grid-stack-item[gs-id="hero"] .dashboard-widget-body {
    overflow: hidden;
}

.home-hero-panel {
    position: relative;
    height: 100%;
    min-height: 100%;
    border-radius: .4rem;
    overflow: hidden;
}

.home-hero-overlay {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 1rem;
    color: #f8fafc;
    background: linear-gradient(0deg, rgba(15, 23, 42, 0.72), rgba(15, 23, 42, 0));
}

.home-hero-clock {
    display: inline-flex;
    flex-direction: column;
    gap: .15rem;
    text-shadow: 0 2px 12px rgba(0, 0, 0, .35);
}

.home-hero-clock-time {
    font-size: clamp(2.4rem, 7vw, 5.4rem);
    font-weight: 800;
    line-height: .95;
    letter-spacing: .02em;
    font-variant-numeric: tabular-nums;
}

.home-hero-clock-date {
    font-size: clamp(.95rem, 2vw, 1.35rem);
    font-weight: 600;
    opacity: .92;
}

.home-hero-clock[hidden],
.home-hero-clock-time[hidden],
.home-hero-clock-date[hidden] {
    display: none !important;
}

.home-grid.is-locked .dashboard-widget {
    cursor: default;
}

.home-grid.is-editing .dashboard-widget {
    outline: 2px dashed rgba(13, 110, 253, .35);
    outline-offset: -2px;
    cursor: move;
    touch-action: none;
}

.dashboard-widget:hover .dashboard-widget-header,
.dashboard-widget:focus-within .dashboard-widget-header,
.home-grid.is-editing .dashboard-widget-header {
    opacity: 1;
    visibility: visible;
}

.home-grid.is-editing .dashboard-widget-close {
    display: inline-flex;
}

.home-grid.is-editing .dashboard-widget-body a,
.home-grid.is-editing .dashboard-widget-body textarea,
.home-grid.is-editing .dashboard-widget-body input,
.home-grid.is-editing .dashboard-widget-body select,
.home-grid.is-editing .dashboard-widget-body button:not(.dashboard-shortcut-remove) {
    pointer-events: none;
}

.grid-stack-item.is-widget-hidden {
    display: none !important;
}

.dashboard-fab-panel {
    position: fixed;
    right: 1.25rem;
    bottom: calc(1.25rem + env(safe-area-inset-bottom));
    z-index: 1035;
    display: inline-flex;
    flex-direction: column;
    gap: .75rem;
    align-items: center;
}

.dashboard-fab {
    width: 3.5rem;
    height: 3.5rem;
    border: 0;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    box-shadow: 0 10px 24px rgba(15, 23, 42, .22);
    touch-action: manipulation;
}

.dashboard-fab:focus-visible {
    outline: 3px solid rgba(13, 110, 253, .35);
    outline-offset: 3px;
}

.dashboard-fab-primary {
    background: #0d6efd;
    font-size: 1.2rem;
}

.dashboard-fab-primary.is-active {
    background: #198754;
}

.dashboard-fab-secondary {
    width: 3rem;
    height: 3rem;
    color: #243547;
    background: #fff;
    border: 1px solid rgba(15, 23, 42, .1);
}

[data-bs-theme="dark"] .dashboard-fab-secondary {
    color: var(--bs-body-color);
    background: var(--gman-surface-raised);
    border-color: var(--bs-border-color);
}

.dashboard-shortcuts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
    gap: .55rem;
}

.dashboard-shortcut {
    position: relative;
    min-height: 3rem;
    --shortcut-icon-size: 1rem;
    --shortcut-text-size: .98rem;
    --shortcut-min-height: 3rem;
    --shortcut-padding-y: .62rem;
    --shortcut-padding-x: .78rem;
    --shortcut-icon-tile-height: 4rem;
}

.dashboard-shortcut.is-hidden {
    display: none;
}

.dashboard-shortcut-link {
    height: 100%;
    min-height: var(--shortcut-min-height);
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: var(--shortcut-padding-y) 2.2rem var(--shortcut-padding-y) var(--shortcut-padding-x);
    border: 1px solid rgba(15, 23, 42, .08);
    border-radius: .5rem;
    color: #243547;
    background: var(--shortcut-bg, #f8fbff);
    text-decoration: none;
    touch-action: manipulation;
    font-size: var(--shortcut-text-size);
}

.dashboard-shortcut-link i {
    font-size: var(--shortcut-icon-size);
}

.dashboard-shortcuts.shortcut-size-xs .dashboard-shortcut-link {
    font-size: .78rem !important;
}

.dashboard-shortcuts.shortcut-size-s .dashboard-shortcut-link {
    font-size: .9rem !important;
}

.dashboard-shortcuts.shortcut-size-m .dashboard-shortcut-link,
.dashboard-shortcuts.shortcut-size-auto .dashboard-shortcut-link {
    font-size: 1rem !important;
}

.dashboard-shortcuts.shortcut-size-l .dashboard-shortcut-link {
    font-size: 1.25rem !important;
}

.dashboard-shortcuts.shortcut-size-xl .dashboard-shortcut-link {
    font-size: 1.55rem !important;
}

.dashboard-shortcuts.shortcut-size-xs .dashboard-shortcut-link i,
.dashboard-shortcuts.shortcut-size-xs .dashboard-shortcut-link svg {
    width: .8rem !important;
    height: .8rem !important;
    font-size: .8rem !important;
}

.dashboard-shortcuts.shortcut-size-s .dashboard-shortcut-link i,
.dashboard-shortcuts.shortcut-size-s .dashboard-shortcut-link svg {
    width: 1rem !important;
    height: 1rem !important;
    font-size: 1rem !important;
}

.dashboard-shortcuts.shortcut-size-m .dashboard-shortcut-link i,
.dashboard-shortcuts.shortcut-size-m .dashboard-shortcut-link svg,
.dashboard-shortcuts.shortcut-size-auto .dashboard-shortcut-link i,
.dashboard-shortcuts.shortcut-size-auto .dashboard-shortcut-link svg {
    width: 1.25rem !important;
    height: 1.25rem !important;
    font-size: 1.25rem !important;
}

.dashboard-shortcuts.shortcut-size-l .dashboard-shortcut-link i,
.dashboard-shortcuts.shortcut-size-l .dashboard-shortcut-link svg {
    width: 1.75rem !important;
    height: 1.75rem !important;
    font-size: 1.75rem !important;
}

.dashboard-shortcuts.shortcut-size-xl .dashboard-shortcut-link i,
.dashboard-shortcuts.shortcut-size-xl .dashboard-shortcut-link svg {
    width: 2.35rem !important;
    height: 2.35rem !important;
    font-size: 2.35rem !important;
}

.dashboard-shortcut-link:hover,
.dashboard-shortcut-link:focus {
    color: #0d6efd;
    border-color: rgba(13, 110, 253, .25);
    background: #fff;
}

[data-bs-theme="dark"] .dashboard-shortcut-link {
    color: var(--bs-body-color);
    background: color-mix(in srgb, var(--shortcut-bg, var(--gman-surface-hover)) 22%, var(--gman-surface-raised));
    border-color: var(--bs-border-color);
}

[data-bs-theme="dark"] .dashboard-shortcut-link:hover,
[data-bs-theme="dark"] .dashboard-shortcut-link:focus {
    color: var(--bs-primary-text-emphasis);
    background: var(--gman-surface-hover);
    border-color: var(--bs-primary-border-subtle);
}

.dashboard-shortcut-link span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dashboard-shortcuts[data-icon-size="xs"] .dashboard-shortcut {
    --shortcut-icon-size: .8rem;
    --shortcut-text-size: .82rem;
    --shortcut-min-height: 2.35rem;
    --shortcut-padding-y: .42rem;
    --shortcut-padding-x: .6rem;
    --shortcut-icon-tile-height: 3rem;
}

.dashboard-shortcuts[data-icon-size="s"] .dashboard-shortcut {
    --shortcut-icon-size: .95rem;
    --shortcut-text-size: .9rem;
    --shortcut-min-height: 2.65rem;
    --shortcut-padding-y: .5rem;
    --shortcut-padding-x: .68rem;
    --shortcut-icon-tile-height: 3.45rem;
}

.dashboard-shortcuts[data-icon-size="m"] .dashboard-shortcut,
.dashboard-shortcuts[data-icon-size="auto"] .dashboard-shortcut {
    --shortcut-icon-size: 1.15rem;
    --shortcut-text-size: .98rem;
    --shortcut-min-height: 3rem;
    --shortcut-padding-y: .62rem;
    --shortcut-padding-x: .78rem;
    --shortcut-icon-tile-height: 4rem;
}

.dashboard-shortcuts[data-icon-size="l"] .dashboard-shortcut {
    --shortcut-icon-size: 1.55rem;
    --shortcut-text-size: 1.08rem;
    --shortcut-min-height: 3.55rem;
    --shortcut-padding-y: .78rem;
    --shortcut-padding-x: .9rem;
    --shortcut-icon-tile-height: 4.85rem;
}

.dashboard-shortcuts[data-icon-size="xl"] .dashboard-shortcut {
    --shortcut-icon-size: 2rem;
    --shortcut-text-size: 1.18rem;
    --shortcut-min-height: 4.25rem;
    --shortcut-padding-y: .95rem;
    --shortcut-padding-x: 1rem;
    --shortcut-icon-tile-height: 5.75rem;
}

.dashboard-shortcuts[data-display-mode="text"] .dashboard-shortcut-link i {
    display: none;
}

.dashboard-shortcuts[data-display-mode="text"] .dashboard-shortcut-link {
    justify-content: center;
    padding-left: 1rem;
    text-align: center;
}

.dashboard-shortcuts[data-display-mode="icon"] {
    grid-template-columns: repeat(auto-fit, minmax(5.25rem, 1fr));
}

.dashboard-shortcuts[data-display-mode="icon"] .dashboard-shortcut {
    min-height: var(--shortcut-icon-tile-height);
}

.dashboard-shortcuts[data-display-mode="icon"] .dashboard-shortcut-link {
    min-height: var(--shortcut-icon-tile-height);
    justify-content: center;
    padding: .75rem;
    aspect-ratio: 1.65 / 1;
}

.dashboard-shortcuts[data-display-mode="icon"] .dashboard-shortcut-link span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
}

.dashboard-shortcuts[data-display-mode="icon"][data-icon-size="auto"] .dashboard-shortcut {
    --shortcut-icon-size: 1.45rem;
    --shortcut-icon-tile-height: 4.35rem;
}

.dashboard-shortcut-remove {
    position: absolute;
    top: .4rem;
    right: .4rem;
    width: 2rem;
    height: 2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: .45rem;
    color: #64748b;
    background: transparent;
    touch-action: manipulation;
}

.dashboard-shortcut-remove:hover,
.dashboard-shortcut-remove:focus {
    color: #dc3545;
    background: rgba(220, 53, 69, .08);
}

.dashboard-shortcut-remove {
    display: none;
}

.home-grid.is-editing .dashboard-shortcut-remove {
    display: inline-flex;
}

.dashboard-swal-popup {
    border-radius: .75rem;
    max-height: min(86vh, 760px);
    display: flex !important;
    flex-direction: column;
}

.dashboard-swal-html {
    overflow-y: auto !important;
    padding: 0 .25rem .25rem;
}

.dashboard-swal-actions-fixed {
    position: sticky;
    bottom: 0;
    z-index: 2;
    flex-shrink: 0;
    width: 100%;
    margin: .75rem 0 0 !important;
    padding-top: .75rem;
    background: linear-gradient(180deg, rgba(255, 255, 255, .86), #fff 35%);
}

[data-bs-theme="dark"] .dashboard-swal-actions-fixed {
    background: linear-gradient(180deg, rgba(43, 48, 53, .86), var(--gman-surface-raised) 35%);
}

.dashboard-swal-manager {
    text-align: left;
}

.dashboard-swal-section + .dashboard-swal-section {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(15, 23, 42, .08);
}

.dashboard-swal-section-title {
    margin-bottom: .55rem;
    font-weight: 700;
    color: #243547;
}

.dashboard-swal-subtitle {
    margin-top: .75rem;
    font-size: .9rem;
}

.dashboard-swal-choice-row {
    display: flex;
    flex-wrap: wrap;
    gap: .45rem;
}

.dashboard-swal-choice {
    min-height: 2.6rem;
    padding: .45rem .85rem;
    border: 1px solid rgba(15, 23, 42, .1);
    border-radius: 999px;
    color: #334155;
    background: #fff;
    touch-action: manipulation;
}

.dashboard-swal-choice.is-selected {
    color: #0d6efd;
    border-color: rgba(13, 110, 253, .35);
    background: rgba(13, 110, 253, .08);
}

.dashboard-swal-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
    gap: .55rem;
}

.dashboard-swal-toggle {
    min-height: 3rem;
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    gap: .65rem;
    padding: .65rem .75rem;
    border: 1px solid rgba(15, 23, 42, .1);
    border-radius: .5rem;
    color: #334155;
    background: #fff;
    text-align: left;
    touch-action: manipulation;
}

.dashboard-swal-toggle.is-selected {
    color: #0d6efd;
    border-color: rgba(13, 110, 253, .35);
    background: rgba(13, 110, 253, .07);
}

.dashboard-swal-toggle span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dashboard-swal-inline-toggle {
    width: auto;
}

.dashboard-swal-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    margin-top: .75rem;
}

[data-bs-theme="dark"] .dashboard-swal-section + .dashboard-swal-section {
    border-color: var(--bs-border-color);
}

[data-bs-theme="dark"] .dashboard-swal-section-title,
[data-bs-theme="dark"] .dashboard-swal-choice,
[data-bs-theme="dark"] .dashboard-swal-toggle {
    color: var(--bs-body-color);
}

[data-bs-theme="dark"] .dashboard-swal-choice,
[data-bs-theme="dark"] .dashboard-swal-toggle {
    background: var(--gman-surface-raised);
    border-color: var(--bs-border-color);
}

[data-bs-theme="dark"] .dashboard-swal-choice.is-selected,
[data-bs-theme="dark"] .dashboard-swal-toggle.is-selected {
    color: var(--bs-primary-text-emphasis);
    background: color-mix(in srgb, var(--bs-primary) 18%, var(--gman-surface-raised));
    border-color: var(--bs-primary-border-subtle);
}

.dashboard-bulletins {
    display: flex;
    flex-direction: column;
    gap: .45rem;
}

.dashboard-bulletins-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    min-height: 1.9rem;
}

.home-grid.is-editing .grid-stack-item[gs-id="bulletins"] .dashboard-bulletins-head {
    padding-right: 5.5rem;
}

.dashboard-bulletins-kicker {
    font-size: .65rem;
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: #64748b;
}

.dashboard-bulletins-title {
    display: flex;
    align-items: baseline;
    gap: .45rem;
    font-size: .98rem;
    font-weight: 800;
    color: #1e293b;
    line-height: 1.2;
}

.dashboard-bulletins-more {
    flex: 0 0 auto;
    min-height: 1.9rem;
    display: inline-flex;
    align-items: center;
    padding: .2rem .55rem;
    font-size: .8rem;
}

.dashboard-bulletin-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
    gap: .65rem;
}

.dashboard-bulletin-card {
    min-width: 0;
    padding: .65rem .75rem;
    border: 1px solid rgba(15, 23, 42, .08);
    border-radius: .75rem;
    background: linear-gradient(135deg, #ffffff 0%, #f8fbff 100%);
    cursor: pointer;
    touch-action: manipulation;
    transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}

.grid-stack-item[gs-id="bulletins"] .dashboard-widget-body {
    padding: .65rem .75rem;
}

.dashboard-bulletin-card:hover,
.dashboard-bulletin-card:focus-visible {
    border-color: var(--bs-primary);
    box-shadow: 0 .35rem .9rem rgba(13, 110, 253, .12);
    outline: none;
}

.dashboard-bulletin-card:active {
    transform: translateY(1px);
}

.dashboard-bulletin-meta {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem .55rem;
    margin-bottom: .35rem;
    font-size: .75rem;
    color: #64748b;
}

.dashboard-bulletin-pin {
    color: #dc3545;
    font-weight: 700;
}

.dashboard-bulletin-title {
    color: #1e293b;
    font-weight: 800;
    line-height: 1.25;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.dashboard-bulletin-preview {
    margin: .35rem 0 0;
    color: #475569;
    font-size: .88rem;
    line-height: 1.45;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.dashboard-bulletin-empty {
    padding: 1rem;
    border: 1px dashed rgba(15, 23, 42, .18);
    border-radius: .75rem;
    color: #64748b;
    background: #f8fafc;
    text-align: center;
}

[data-bs-theme="dark"] .dashboard-bulletins-kicker,
[data-bs-theme="dark"] .dashboard-bulletin-meta,
[data-bs-theme="dark"] .dashboard-bulletin-empty {
    color: var(--bs-secondary-color);
}

[data-bs-theme="dark"] .dashboard-bulletins-title,
[data-bs-theme="dark"] .dashboard-bulletin-title {
    color: var(--bs-body-color);
}

[data-bs-theme="dark"] .dashboard-bulletin-preview {
    color: var(--bs-secondary-color);
}

[data-bs-theme="dark"] .dashboard-bulletin-card {
    background: linear-gradient(135deg, var(--gman-surface-raised), var(--gman-surface-soft));
    border-color: var(--bs-border-color);
}

[data-bs-theme="dark"] .dashboard-bulletin-empty {
    background: var(--gman-surface-soft);
    border-color: var(--bs-border-color);
}

#tw-year-cal.container {
    max-width: 100%;
    margin: 0;
    padding: 0;
}

/* ====== 年曆表格基礎 ====== */
.tw-month-table {
    table-layout: fixed;
    width: 100%;
}

.tw-month-table th,
.tw-month-table td {
    width: 14.285%;
    padding: .35rem .3rem;
}

.tw-month-table thead th {
    font-weight: 700;
}

/* ====== 每日格子（內容藏在格子內） ====== */
.tw-day {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: .15rem;
    min-height: 3.75rem;
    border-radius: .6rem;
    padding: .2rem .35rem;
    font-size: .75rem;
    line-height: 1.2;
    cursor: default;
    overflow: hidden;
}

.tw-day .tw-date {
    font-weight: 600;
    line-height: 1;
    font-size: .8rem;
}

.tw-day .tw-desc {
    font-size: .7rem;
    line-height: 1.1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tw-day .tw-leaves {
    display: flex;
    flex-wrap: wrap;
    gap: .12rem;
    width: 100%;
    min-width: 0;
}

.tw-leave-legend,
.tw-day .tw-leave-count {
    background: #eef5ff;
    color: #164a89;
    border: 1px solid #b8d8ff;
}

.tw-day .tw-leave-count {
    display: inline-flex;
    align-items: center;
    gap: .18rem;
    max-width: 100%;
    padding: .06rem .22rem;
    border-radius: .25rem;
    font-size: .64rem;
    line-height: 1.15;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tw-day .tw-leave-count:hover,
.tw-day .tw-leave-count:focus {
    background: #dceeff;
    color: #0d3d75;
    border-color: #2f80ed;
    outline: none;
}

.tw-day .tw-leave-count i {
    font-size: .7rem;
}

.tw-leave-detail-list {
    display: flex;
    flex-direction: column;
    gap: .5rem;
    text-align: left;
}

.tw-leave-detail-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    gap: .5rem;
    padding: .55rem .65rem;
    border: 1px solid #d8e6f8;
    border-radius: .45rem;
    background: #f8fbff;
}

.tw-leave-detail-main {
    min-width: 0;
}

.tw-leave-detail-name {
    font-weight: 700;
    color: #17324d;
}

.tw-leave-detail-name span,
.tw-leave-detail-meta {
    color: #5a6b7a;
    font-size: .86rem;
}

.tw-leave-detail-type {
    display: inline-block;
    padding: .12rem .38rem;
    border-radius: 999px;
    background: #eef5ff;
    color: #164a89;
    border: 1px solid #b8d8ff;
    font-size: .78rem;
    white-space: nowrap;
}

.tw-day.holiday {
    background: #daa1a6;
}

.tw-day.makeup-off {
    background: #fff6da;
}

.tw-day.makeup-work {
    background: #e8f8fc;
}

.tw-day.weekend:not(.holiday):not(.makeup-off):not(.makeup-work) {
    background: #fafbfc;
}

.bg-twday-today {
    background: #00b500;
}

.bg-twday-makeupwork {
    background: #e8f8fc;
}

.tw-day.today {
    background: #00b500;
    outline: 2px solid var(--bs-primary);
    box-shadow: inset 0 0 0 1px #fff;
    color: #fbfbfb;
}

[data-bs-theme="dark"] .tw-month-table,
[data-bs-theme="dark"] .tw-month-table th,
[data-bs-theme="dark"] .tw-month-table td {
    color: var(--bs-body-color);
    border-color: var(--bs-border-color);
}

[data-bs-theme="dark"] .tw-leave-legend,
[data-bs-theme="dark"] .tw-day .tw-leave-count,
[data-bs-theme="dark"] .tw-leave-detail-type {
    color: var(--bs-primary-text-emphasis);
    background: color-mix(in srgb, var(--bs-primary) 18%, var(--gman-surface-raised));
    border-color: var(--bs-primary-border-subtle);
}

[data-bs-theme="dark"] .tw-day .tw-leave-count:hover,
[data-bs-theme="dark"] .tw-day .tw-leave-count:focus {
    color: var(--bs-primary-text-emphasis);
    background: color-mix(in srgb, var(--bs-primary) 28%, var(--gman-surface-raised));
    border-color: var(--bs-primary);
}

[data-bs-theme="dark"] .tw-leave-detail-row {
    background: var(--gman-surface-soft);
    border-color: var(--bs-border-color);
}

[data-bs-theme="dark"] .tw-leave-detail-name {
    color: var(--bs-body-color);
}

[data-bs-theme="dark"] .tw-leave-detail-name span,
[data-bs-theme="dark"] .tw-leave-detail-meta {
    color: var(--bs-secondary-color);
}

[data-bs-theme="dark"] .tw-day.holiday {
    background: color-mix(in srgb, var(--bs-danger) 24%, var(--gman-surface-raised));
}

[data-bs-theme="dark"] .tw-day.makeup-off {
    background: color-mix(in srgb, var(--bs-warning) 18%, var(--gman-surface-raised));
}

[data-bs-theme="dark"] .tw-day.makeup-work,
[data-bs-theme="dark"] .bg-twday-makeupwork {
    background: color-mix(in srgb, var(--bs-info) 18%, var(--gman-surface-raised));
}

[data-bs-theme="dark"] .tw-day.weekend:not(.holiday):not(.makeup-off):not(.makeup-work) {
    background: var(--gman-surface-soft);
}

[data-bs-theme="dark"] .tw-day.today {
    color: #fff;
    background: var(--bs-success);
    box-shadow: inset 0 0 0 1px var(--bs-body-bg);
}

[data-bs-theme="dark"] .home-dashboard-page .grid-stack-placeholder > .placeholder-content {
    background: var(--bs-primary-bg-subtle);
    border-color: var(--bs-primary-border-subtle);
}

.tw-empty {
    background: transparent !important;
}

.monthContain {
    margin-bottom: 1em;
}

td.tw-tiphost {
    position: relative;
    overflow: visible;
}

/* 讓 tooltip 能溢出 */
td.tw-tiphost::after,
td.tw-tiphost::before {
    position: absolute;
    left: 50%;
    transform: translate(-50%, -6px);
    opacity: 0;
    visibility: hidden;
    transition: opacity .12s ease, transform .12s ease;
    pointer-events: none;
    z-index: 1065;
}

td.tw-tiphost::after {
    content: attr(data-tip);
    bottom: calc(100% + 8px);
    background: rgba(33, 37, 41, .92);
    color: #fff;
    font-size: .82rem;
    line-height: 1.3;
    padding: .4rem .5rem;
    border-radius: .375rem;
    max-width: 240px;
    min-width: 120px;
    white-space: pre-wrap;
    word-break: break-word;
    text-align: left;
    box-shadow: 0 4px 14px rgba(0, 0, 0, .18);
}

td.tw-tiphost::before {
    content: "";
    bottom: calc(100% + 4px);
    border: 6px solid transparent;
    border-top-color: rgba(33, 37, 41, .92);
}

td.tw-tiphost:hover::after,
td.tw-tiphost:hover::before,
td.tw-tiphost.tip-open::after,
td.tw-tiphost.tip-open::before {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, 0);
}

td.tw-tiphost[data-tip-pos="left"]::after,
td.tw-tiphost[data-tip-pos="left"]::before {
    left: 0;
    transform: translate(0, -6px);
}

td.tw-tiphost[data-tip-pos="left"]:hover::after,
td.tw-tiphost[data-tip-pos="left"]:hover::before,
td.tw-tiphost.tip-open[data-tip-pos="left"]::after,
td.tw-tiphost.tip-open[data-tip-pos="left"]::before {
    transform: translate(0, 0);
}

td.tw-tiphost[data-tip-pos="right"]::after,
td.tw-tiphost[data-tip-pos="right"]::before {
    left: 100%;
    transform: translate(-100%, -6px);
}

td.tw-tiphost[data-tip-pos="right"]:hover::after,
td.tw-tiphost[data-tip-pos="right"]:hover::before,
td.tw-tiphost.tip-open[data-tip-pos="right"]::after,
td.tw-tiphost.tip-open[data-tip-pos="right"]::before {
    transform: translate(-100%, 0);
}

@media (max-width: 991.98px) {
    .dashboard-widget-header {
        padding: .6rem .8rem;
    }

    .dashboard-widget-body {
        padding: .75rem;
    }

    .dashboard-shortcuts:not([data-display-mode="icon"]),
    .dashboard-swal-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-shortcuts[data-display-mode="icon"] {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 575.98px) {
    .dashboard-fab-panel {
        right: .9rem;
        bottom: calc(78px + env(safe-area-inset-bottom));
    }

    .dashboard-fab {
        width: 3.25rem;
        height: 3.25rem;
    }

    .dashboard-fab-secondary {
        width: 2.85rem;
        height: 2.85rem;
    }
}

@media (pointer: coarse) {
    .dashboard-widget-header {
        min-height: 2.8rem;
    }

    .dashboard-widget-close,
    .dashboard-header-action {
        min-width: 2.6rem;
        min-height: 2.6rem;
    }

    .grid-stack-item > .ui-resizable-handle,
    .grid-stack-item > .gs-resize-handle {
        width: 20px;
        height: 20px;
    }
}
