/* 系統內頁頁首右側：與 HR 等頁一致（時鐘、首頁、用戶選單） */
.header h1 {
    font-size: 1.9em;
    margin-bottom: 6px;
}
.header p {
    opacity: 0.9;
}
.header-actions {
    position: absolute;
    right: 20px;
    top: 20px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: center;
}
.user-menu-wrapper {
    position: relative;
}
.user-menu-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 10px;
    font-weight: 700;
    font-size: 14px;
    border: 2px solid rgba(255, 255, 255, 0.35);
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
    transition: all 0.25s;
    cursor: pointer;
}
.user-menu-btn:hover {
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.26);
    border-color: rgba(255, 255, 255, 0.55);
}
.user-menu-btn::after {
    content: '▼';
    font-size: 10px;
    transition: transform 0.3s;
}
.user-menu-btn.active::after {
    transform: rotate(180deg);
}
.user-menu-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    min-width: 200px;
    z-index: 1000;
    display: none;
    overflow: hidden;
}
.user-menu-dropdown.show {
    display: block;
}
.user-menu-item {
    display: block;
    padding: 12px 16px;
    color: #2d2f36;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    transition: background 0.2s;
    border-bottom: 1px solid #f0f0f0;
}
.user-menu-item:last-child {
    border-bottom: none;
}
.user-menu-item:hover {
    background: #f8f9fa;
}
.user-menu-item button {
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    color: inherit;
    font: inherit;
    cursor: pointer;
    padding: 0;
}
.user-menu-item.user-info {
    background: #f8f9fa;
    font-weight: 700;
    color: #667eea;
    cursor: default;
}
.user-menu-item.user-info:hover {
    background: #f8f9fa;
}
.user-menu-switch-heading {
    cursor: default;
    font-size: 12px;
    font-weight: 700;
    color: #6c757d;
    text-transform: none;
    letter-spacing: 0.02em;
    background: #fff;
    padding-top: 10px;
    padding-bottom: 6px;
}
.user-menu-switch-heading:hover {
    background: #fff;
}
.htfl-switch-account-list {
    max-height: 220px;
    overflow-y: auto;
}
.htfl-switch-account-row {
    display: flex;
    align-items: stretch;
    border-bottom: 1px solid #f0f0f0;
    background: #fff;
}
.htfl-switch-account-row:hover {
    background: #f8f9fa;
}
.htfl-switch-account-pick {
    flex: 1;
    text-align: left;
    background: none;
    border: none;
    color: #2d2f36;
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    padding: 10px 8px 10px 16px;
}
.htfl-switch-account-pick .htfl-switch-account-meta {
    display: block;
    margin-top: 2px;
    font-size: 12px;
    font-weight: 500;
    color: #868e96;
}
.htfl-switch-account-badge {
    display: inline-block;
    margin-left: 8px;
    padding: 1px 6px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    color: #2b8a3e;
    background: #d3f9d8;
    vertical-align: middle;
}
.htfl-switch-account-remove {
    flex: 0 0 auto;
    width: 36px;
    border: none;
    background: none;
    color: #adb5bd;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    padding: 0;
}
.htfl-switch-account-remove:hover {
    color: #c92a2a;
    background: #fff5f5;
}
.header-btn {
    padding: 10px 16px;
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-radius: 10px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.25s;
    display: inline-block;
}
.header-btn:hover {
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.26);
    border-color: rgba(255, 255, 255, 0.55);
}

.htfl-notifications-wrapper {
    position: relative;
}
.htfl-notifications-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    padding: 0;
    border-radius: 10px;
    font-weight: 700;
    font-size: 18px;
    line-height: 1;
    border: 2px solid rgba(255, 255, 255, 0.35);
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
    transition: all 0.25s;
    cursor: pointer;
}
.htfl-notifications-btn:hover,
.htfl-notifications-btn.active {
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.26);
    border-color: rgba(255, 255, 255, 0.55);
}
.htfl-notifications-icon {
    display: block;
    font-size: 18px;
    line-height: 1;
}
.htfl-notifications-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: #ef4444;
    color: #fff;
    font-size: 11px;
    font-weight: 800;
    line-height: 18px;
    text-align: center;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}
.htfl-notifications-badge[hidden] {
    display: none !important;
}
.htfl-notifications-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    min-width: 320px;
    max-width: min(420px, calc(100vw - 24px));
    z-index: 1001;
    display: none;
    overflow: hidden;
}
.htfl-notifications-dropdown.show {
    display: block;
}
.htfl-notifications-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 12px;
    border-bottom: 1px solid #f0f0f0;
    background: #f8f9fa;
}
.htfl-notifications-title {
    font-size: 14px;
    font-weight: 700;
    color: #334155;
}
.htfl-notifications-dismiss-all {
    border: 0;
    background: none;
    color: #2563eb;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 6px;
}
.htfl-notifications-dismiss-all:hover {
    background: #eff6ff;
}
.htfl-notifications-list {
    max-height: min(360px, 50vh);
    overflow-y: auto;
}
.htfl-notifications-item {
    display: flex;
    align-items: stretch;
    border-bottom: 1px solid #f0f0f0;
}
.htfl-notifications-item:last-child {
    border-bottom: none;
}
.htfl-notifications-item-link {
    flex: 1 1 auto;
    min-width: 0;
    display: block;
    padding: 10px 12px;
    text-decoration: none;
    color: #2d2f36;
    transition: background 0.2s;
}
.htfl-notifications-item-link:hover {
    background: #f8fafc;
}
.htfl-notifications-item-title {
    font-size: 13px;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 2px;
}
.htfl-notifications-item-message {
    font-size: 12px;
    color: #64748b;
    line-height: 1.35;
}
.htfl-notifications-item-time {
    font-size: 11px;
    color: #94a3b8;
    margin-top: 4px;
}
.htfl-notifications-item-dismiss {
    flex: 0 0 auto;
    width: 36px;
    border: 0;
    border-left: 1px solid #f0f0f0;
    background: #fff;
    color: #94a3b8;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
}
.htfl-notifications-item-dismiss:hover {
    background: #fef2f2;
    color: #dc2626;
}
.htfl-notifications-empty,
.htfl-notifications-status {
    padding: 16px 12px;
    text-align: center;
    font-size: 13px;
    color: #64748b;
}

.htfl-llm-balance {
    display: inline-block;
    font-family: ui-monospace, 'Cascadia Code', 'Consolas', monospace;
    font-variant-numeric: tabular-nums;
    font-size: 12px;
    font-weight: 600;
    margin-right: 8px;
    padding: 2px 7px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.22);
    color: rgba(255, 255, 255, 0.95);
    white-space: nowrap;
    vertical-align: middle;
}

.htfl-llm-balance.is-reserved {
    min-width: 4.85rem;
    text-align: center;
    box-sizing: border-box;
}

.htfl-llm-balance.is-pending {
    opacity: 0.5;
}

.htfl-llm-balance.is-guest {
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
}

.htfl-llm-balance[hidden] {
    display: none !important;
}

/* 右下角浮動「回到最頂」（由 htfl-back-to-top.js 注入） */
.htfl-back-to-top {
    position: fixed;
    right: max(16px, env(safe-area-inset-right, 0px));
    bottom: max(16px, env(safe-area-inset-bottom, 0px));
    z-index: 9000;
    width: 48px;
    height: 48px;
    padding: 0;
    border: none;
    border-radius: 999px;
    background: #1e3a5f;
    color: #fff;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.28);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(12px);
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease, background 0.2s ease;
}

.htfl-back-to-top.is-visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
}

.htfl-back-to-top:hover {
    background: #254a78;
}

.htfl-back-to-top:focus {
    outline: none;
}

.htfl-back-to-top:focus-visible {
    outline: 3px solid #93c5fd;
    outline-offset: 3px;
}

.htfl-back-to-top-icon {
    font-size: 22px;
    font-weight: 700;
    line-height: 1;
}

@media (max-width: 768px) {
    .htfl-back-to-top {
        width: 44px;
        height: 44px;
        right: max(12px, env(safe-area-inset-right, 0px));
        bottom: max(12px, env(safe-area-inset-bottom, 0px));
    }

    .htfl-back-to-top-icon {
        font-size: 20px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .htfl-back-to-top {
        transition: none;
    }
}

/* 手機頁首版面以 static/css/htfl-mobile.css 為準；各系統頁應載入該檔。 */
