:root {
    --ink: #1a2332;
    --ink-soft: #475068;
    --paper: #f6f4ef;
    --card: #ffffff;
    --brand: #0a5d8f; /* 資策會藍 */
    --brand-deep: #073f63;
    --brand-bright: #1789c9;
    --accent: #f2a900; /* 認證金 */
    --line: #dfe3ea;
    --shadow: 0 10px 40px -12px rgba(7, 63, 99, 0.28);
}
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}
html {
    scroll-behavior: smooth;
}
body {
    font-family:
        "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
    background: var(--paper);
    color: var(--ink);
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
}

/* ========== 靜態背景頁（仿官網首頁，全區不可互動）========== */
.bg-page {
    pointer-events: none;
    user-select: none;
    min-height: 100vh;
}
.bg-topbar {
    background: var(--brand-deep);
    color: #fff;
    font-size: 0.76rem;
}
.bg-topbar-in {
    max-width: 1140px;
    margin: 0 auto;
    padding: 7px 24px;
    display: flex;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    opacity: 0.92;
}
.bg-header {
    background: #fff;
    border-bottom: 1px solid var(--line);
    box-shadow: 0 2px 12px rgba(7, 63, 99, 0.06);
}
.bg-nav {
    max-width: 1140px;
    margin: 0 auto;
    padding: 14px 24px;
    display: flex;
    align-items: center;
    gap: 24px;
}
.bg-brand {
    display: flex;
    align-items: center;
    gap: 11px;
    flex: 0 0 auto;
}
.bg-logo {
    width: 44px;
    height: 44px;
    border-radius: 11px;
    background: linear-gradient(135deg, var(--brand), var(--brand-bright));
    color: #fff;
    display: grid;
    place-items: center;
    font-weight: 900;
    font-size: 1.05rem;
    letter-spacing: 0.5px;
}
.bg-brandtext {
    font-weight: 800;
    font-size: 1.08rem;
    color: var(--ink);
    line-height: 1.2;
}
.bg-brandtext small {
    display: block;
    font-weight: 500;
    font-size: 0.62rem;
    color: var(--ink-soft);
    letter-spacing: 0.5px;
}
.bg-menu {
    display: flex;
    gap: 22px;
    flex: 1;
    justify-content: center;
    flex-wrap: wrap;
}
.bg-menu-item {
    font-size: 0.92rem;
    color: var(--ink-soft);
    font-weight: 600;
    white-space: nowrap;
}
.bg-menu-item.active {
    color: var(--brand);
    position: relative;
}
.bg-menu-item.active::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -6px;
    height: 3px;
    border-radius: 2px;
    background: var(--brand);
}
.bg-login {
    font-size: 0.86rem;
    color: var(--brand);
    font-weight: 700;
    flex: 0 0 auto;
}

.bg-hero {
    background: linear-gradient(135deg, #eaf3f9 0%, #f6f4ef 70%);
    overflow: hidden;
}
.bg-hero-in {
    max-width: 1140px;
    margin: 0 auto;
    padding: 64px 24px;
    display: grid;
    grid-template-columns: 1.25fr 0.75fr;
    gap: 40px;
    align-items: center;
}
.bg-eyebrow {
    display: inline-block;
    background: rgba(10, 93, 143, 0.1);
    color: var(--brand);
    font-weight: 700;
    font-size: 0.76rem;
    letter-spacing: 1.5px;
    padding: 6px 14px;
    border-radius: 999px;
    margin-bottom: 18px;
}
.bg-hero-text h1 {
    font-size: 2.9rem;
    line-height: 1.25;
    font-weight: 900;
    letter-spacing: -0.5px;
    color: var(--ink);
}
.bg-hl {
    color: var(--brand);
    position: relative;
}
.bg-hl::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 5px;
    height: 11px;
    background: rgba(242, 169, 0, 0.32);
    z-index: -1;
}
.bg-hero-text p {
    margin-top: 18px;
    font-size: 1.05rem;
    color: var(--ink-soft);
    max-width: 48ch;
}
.bg-btnrow {
    margin-top: 28px;
    display: flex;
    gap: 14px;
}
.bg-btn {
    display: inline-flex;
    align-items: center;
    font-weight: 700;
    font-size: 0.98rem;
    padding: 13px 26px;
    border-radius: 12px;
}
.bg-btn-primary {
    background: var(--brand);
    color: #fff;
    box-shadow: var(--shadow);
}
.bg-btn-ghost {
    background: #fff;
    color: var(--brand);
    border: 1.5px solid var(--line);
}
.bg-hero-card {
    background: #fff;
    border-radius: 22px;
    padding: 28px;
    box-shadow: var(--shadow);
    border: 1px solid var(--line);
}
.bg-hero-cardtitle {
    font-size: 1rem;
    color: var(--ink-soft);
    font-weight: 700;
    margin-bottom: 14px;
}
.bg-stat {
    display: flex;
    align-items: baseline;
    gap: 11px;
    padding: 11px 0;
    border-bottom: 1px dashed var(--line);
}
.bg-stat:last-child {
    border-bottom: none;
}
.bg-stat b {
    font-size: 1.8rem;
    font-weight: 900;
    color: var(--brand);
    flex: 0 0 auto;
}
.bg-stat span {
    font-size: 0.88rem;
    color: var(--ink-soft);
}

.bg-certs {
    max-width: 1140px;
    margin: 0 auto;
    padding: 56px 24px;
}
.bg-certs h2 {
    font-size: 1.7rem;
    font-weight: 900;
    color: var(--ink);
}
.bg-sub {
    color: var(--ink-soft);
    margin: 8px 0 28px;
    font-size: 0.98rem;
}
.bg-certgrid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(238px, 1fr));
    gap: 18px;
}
.bg-cert {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 24px;
    position: relative;
    overflow: hidden;
}
.bg-cert::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 5px;
    background: linear-gradient(90deg, var(--brand), var(--brand-bright));
}
.bg-tag {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--accent);
    letter-spacing: 1px;
}
.bg-cert h4 {
    font-size: 1.12rem;
    margin: 8px 0 10px;
    font-weight: 800;
    color: var(--ink);
}
.bg-cert p {
    font-size: 0.9rem;
    color: var(--ink-soft);
}
.bg-price {
    margin-top: 14px;
    font-weight: 800;
    color: var(--brand);
    font-size: 0.95rem;
}

.bg-foot {
    background: var(--brand-deep);
    color: #fff;
    margin-top: 20px;
}
.bg-foot-in {
    max-width: 1140px;
    margin: 0 auto;
    padding: 40px 24px 20px;
    display: flex;
    justify-content: space-between;
    gap: 30px;
    flex-wrap: wrap;
    font-size: 0.9rem;
    line-height: 1.9;
    opacity: 0.95;
}
.bg-foot-in strong {
    font-size: 0.98rem;
}
.bg-copy {
    max-width: 1140px;
    margin: 0 auto;
    padding: 14px 24px 30px;
    font-size: 0.78rem;
    opacity: 0.6;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
}

@media (max-width: 820px) {
    .bg-hero-in {
        grid-template-columns: 1fr;
        padding: 40px 24px;
    }
    .bg-hero-text h1 {
        font-size: 2.1rem;
    }
    .bg-menu {
        display: none;
    }
}

/* ---------- 頁首 ---------- */
/* ---------- 區段（供對話框等沿用）---------- */

/* ---------- Q版小助手 ---------- */
.mascot-wrap {
    position: fixed;
    right: 26px;
    top: 50%;
    transform: translateY(-50%) scale(1.25);
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}
.mascot-bubble {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 16px 16px 4px 16px;
    padding: 10px 14px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--ink);
    box-shadow: var(--shadow);
    margin-bottom: 12px;
    max-width: 180px;
    animation: floatup 0.6s ease;
    cursor: pointer;
}
@keyframes floatup {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
.mascot {
    width: 96px;
    height: 112px;
    cursor: pointer;
    border: none;
    background: none;
    padding: 0;
    filter: drop-shadow(0 8px 18px rgba(7, 63, 99, 0.3));
    transition: transform 0.2s;
}
.mascot:hover {
    transform: scale(1.06);
}
.mascot svg {
    width: 100%;
    height: 100%;
    display: block;
    overflow: visible;
}

/* 身體整體呼吸起伏（待命）*/
#mBody {
    transform-box: fill-box;
    transform-origin: center bottom;
    animation: breathe 3.4s ease-in-out infinite;
}
@keyframes breathe {
    0%,
    100% {
        transform: translateY(0) scaleY(1);
    }
    50% {
        transform: translateY(-3px) scaleY(1.015);
    }
}
/* 頭部輕微擺動 */
#mHead {
    transform-box: fill-box;
    transform-origin: center bottom;
    animation: headtilt 5s ease-in-out infinite;
}
@keyframes headtilt {
    0%,
    100% {
        transform: rotate(0deg);
    }
    25% {
        transform: rotate(2.5deg);
    }
    75% {
        transform: rotate(-2.5deg);
    }
}
/* 影子隨呼吸縮放 */
#mShadow {
    transform-box: fill-box;
    transform-origin: center;
    animation: shadowpulse 3.4s ease-in-out infinite;
}
@keyframes shadowpulse {
    0%,
    100% {
        transform: scaleX(1);
        opacity: 0.16;
    }
    50% {
        transform: scaleX(0.92);
        opacity: 0.12;
    }
}

/* 眨眼（JS 觸發）：可雙眼一起眨，也可單眼眨 */
.blinking #eyeL,
.blink-l #eyeL {
    opacity: 0;
}
.blinking #eyeR,
.blink-r #eyeR {
    opacity: 0;
}
.blinking #blinkL,
.blink-l #blinkL {
    opacity: 1;
}
.blinking #blinkR,
.blink-r #blinkR {
    opacity: 1;
}

/* ---------- 對話框 ---------- */
.chat {
    position: fixed;
    right: 26px;
    bottom: 26px;
    z-index: 110;
    width: clamp(320px, 28vw, 460px);
    height: clamp(520px, 75vh, 960px);
    max-width: calc(100vw - 32px);
    max-height: calc(100vh - 48px);

    font-size: 16px;
    background: var(--card);
    border-radius: 22px;
    box-shadow: 0 24px 60px -16px rgba(7, 63, 99, 0.4);
    display: none;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--line);
}
.chat.open {
    display: flex;
    animation: pop 0.25s ease;
}
@keyframes pop {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}
.chat-head {
    background: linear-gradient(135deg, var(--brand-deep), var(--brand));
    color: #fff;
    padding: 16px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
}
.chat-head .avatar {
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
}
.chat-head .who {
    flex: 1;
}
.chat-head .who strong {
    font-size: 1rem;
    display: block;
}
.chat-head .who span {
    font-size: 0.76rem;
    opacity: 0.85;
}
.chat-head .who span::before {
    content: "●";
    color: #5ee08a;
    margin-right: 5px;
    font-size: 0.7rem;
}
.chat-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: #fff;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.1rem;
    line-height: 1;
}
.chat-close:hover {
    background: rgba(255, 255, 255, 0.35);
}

.chat-body {
    flex: 1;
    overflow-y: auto;
    padding: 18px;
    background: #f9fafc;
    display: flex;
    flex-direction: column;
    gap: 12px;
    position: relative;
}
.msg {
    max-width: 88%;
    padding: 10px 13px;
    border-radius: 14px;
    font-size: 0.9rem;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
}
.msg.bot {
    background: #fff;
    border: 1px solid var(--line);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}
.msg.greeting-msg {
    max-width: 100%;
    white-space: nowrap;
}
.img-msg {
    padding: 6px !important;
}
.sample-img {
    max-width: 100%;
    border-radius: 8px;
    cursor: zoom-in;
    display: block;
}
.msg.user {
    background: var(--brand);
    color: #fff;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}
.msg.bot a {
    color: var(--brand);
    font-weight: 600;
}
.quick {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 2px;
}
.quick button {
    background: #eaf3f9;
    border: 1px solid #cfe4f1;
    color: var(--brand);
    font-family: inherit;
    font-size: 0.8rem;
    padding: 7px 12px;
    border-radius: 999px;
    cursor: pointer;
    transition: background 0.15s;
}
.quick button:hover {
    background: #d8ebf6;
}
.menu {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-top: 4px;
    align-self: stretch;
}
.menu-group {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 12px 14px;
}
.menu-title {
    font-size: 0.82rem;
    font-weight: 800;
    color: var(--brand-deep);
    margin-bottom: 9px;
    display: flex;
    align-items: center;
    gap: 7px;
}
.menu-title::before {
    content: "";
    width: 4px;
    height: 14px;
    background: var(--accent);
    border-radius: 2px;
}
.typing {
    display: flex;
    gap: 4px;
    padding: 4px 2px;
}
.typing span {
    width: 7px;
    height: 7px;
    background: #b6c2d0;
    border-radius: 50%;
    animation: blink 1.2s infinite;
}
.typing span:nth-child(2) {
    animation-delay: 0.2s;
}
.typing span:nth-child(3) {
    animation-delay: 0.4s;
}
@keyframes blink {
    0%,
    60%,
    100% {
        opacity: 0.3;
    }
    30% {
        opacity: 1;
    }
}

.chat-foot {
    padding: 12px;
    border-top: 1px solid var(--line);
    display: flex;
    gap: 8px;
    background: #fff;
}
.chat-foot input {
    flex: 1;
    border: 1.5px solid var(--line);
    border-radius: 12px;
    padding: 11px 14px;
    font-family: inherit;
    font-size: 0.9rem;
    outline: none;
}
.chat-foot input:focus {
    border-color: var(--brand);
}
.chat-foot button {
    background: var(--brand);
    border: none;
    color: #fff;
    width: 46px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 1.1rem;
    transition: background 0.2s;
}
.chat-foot button:hover {
    background: var(--brand-deep);
}
.chat-foot input:disabled {
    background: #f1f3f6;
    cursor: not-allowed;
}
.chat-foot button:disabled {
    background: #b6c2d0;
    cursor: not-allowed;
}
.msg-link {
    margin-top: 9px;
    padding-top: 9px;
    border-top: 1px dashed var(--line);
}
.msg-link a {
    font-size: 0.82rem;
    color: var(--brand);
    text-decoration: none;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.msg-link a:hover {
    text-decoration: underline;
}
/* 緊接在回覆泡泡下方的連結列 */
.msg-link-row {
    align-self: flex-start;
    margin-top: -4px;
    margin-left: 2px;
}
.msg-link-row a {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.84rem;
    color: var(--brand);
    font-weight: 700;
    text-decoration: none;
    background: #eef6fc;
    border: 1px solid #bfdcef;
    border-radius: 9px;
    padding: 7px 11px;
}
.msg-link-row a:hover {
    background: #e2eff9;
    text-decoration: underline;
}

/* 回答有幫助嗎？回饋列 */
.fb-row {
    align-self: flex-start;
    margin: 12px 0 8px 12px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
}
.fb-label {
    font-size: 0.78rem;
    color: #8e8e93;
    font-weight: 500;
}
.fb-btn-group {
    display: flex;
    gap: 6px;
}
.fb-btn {
    background: #f2f2f7;
    border: none;
    border-radius: 100px;
    padding: 5px 12px;
    font-size: 0.75rem;
    color: #3a3a3c;
    cursor: pointer;
    font-family: inherit;
    display: flex;
    align-items: center;
    gap: 4px;
    transition:
        background 0.2s ease,
        transform 0.1s ease;
}
.fb-btn:hover {
    background: #eaf3f9;
    border-color: #bfdcef;
}
.fb-btn:active {
    transform: scale(0.94);
}
.fb-thanks {
    font-size: 0.78rem;
    color: #8e8e93;
    font-weight: 700;
}

/* ---------- 測試用登入卡片 ---------- */
.login-card {
    max-width: 270px;
    width: 100%;
    background: #fff !important;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 16px 16px !important;
    color: var(--ink) !important;
    line-height: 1.3;
    white-space: normal !important;
}
.login-title {
    text-align: center;
    font-size: 1.02rem;
    font-weight: 800;
    color: #1a1a2e;
    margin: 0 0 2px;
    line-height: 1.3;
}
.login-sub {
    text-align: center;
    font-size: 0.74rem;
    color: #b08900;
    background: #fff8e6;
    border-radius: 6px;
    padding: 4px 8px;
    margin: 0 0 12px;
    line-height: 1.3;
}
.login-label {
    display: block;
    font-size: 0.84rem;
    color: #333;
    margin: 9px 0 4px;
    font-weight: 600;
    line-height: 1.3;
}
.login-pwrow {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.login-forgot {
    color: #999;
    font-weight: 500;
    font-size: 0.74rem;
}
.login-input {
    width: 100%;
    box-sizing: border-box;
    padding: 9px 10px;
    border: 1px solid #d8dde3;
    border-radius: 7px;
    font-size: 0.88rem;
    font-family: inherit;
    outline: none;
    line-height: 1.3;
    transition: border-color 0.15s;
}
.login-input:focus {
    border-color: var(--brand);
}
.login-input.login-input-err {
    border-color: #e23b3b;
    background: #fff5f5;
}
.login-input:disabled {
    background: #f1f3f6;
}
.login-btn {
    width: 100%;
    margin-top: 13px;
    padding: 10px;
    background: #1a1a2e;
    color: #fff;
    border: none;
    border-radius: 7px;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    line-height: 1.3;
    transition: background 0.15s;
}
.login-btn:hover:not(:disabled) {
    background: #2a2a44;
}
.login-btn:disabled {
    background: #9aa0ab;
    cursor: not-allowed;
}
.login-or {
    text-align: center;
    color: #aaa;
    font-size: 0.74rem;
    margin: 10px 0;
    line-height: 1.3;
}
.login-google {
    width: 100%;
    padding: 9px;
    background: #fff;
    border: 1px solid #d8dde3;
    border-radius: 7px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #333;
    cursor: pointer;
    font-family: inherit;
    line-height: 1.3;
}
.login-google:hover {
    background: #f7f8fa;
}
.login-signup {
    text-align: center;
    font-size: 0.79rem;
    color: #666;
    margin-top: 11px;
    line-height: 1.3;
}
.login-signup span {
    color: var(--brand);
    font-weight: 700;
    cursor: pointer;
}
.login-err {
    margin-top: 7px;
    font-size: 0.77rem;
    color: #d23;
    text-align: center;
    min-height: 0;
    line-height: 1.3;
}
.login-err:empty {
    margin-top: 0;
}
.login-ok {
    margin-top: 10px;
    text-align: center;
    font-size: 0.95rem;
    font-weight: 800;
    color: #1a8a4a;
}

/* ---------- 擬真通知單卡片 ---------- */
.ticket-card {
    align-self: flex-start;
    max-width: 88%;
    background: #fff !important;
    border: 1px solid #d8e6d8;
    border-radius: 14px !important;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(7, 63, 99, 0.08);
    line-height: 1.5;
    padding: 0 !important;
    white-space: normal !important;
}

/* ---------- 確認通知卡片（帶資料 + 進行編修/送出通知）---------- */
.confirm-card {
    align-self: flex-start;
    max-width: 90%;
    width: 100%;
    background: #fffdf5;
    border: 1px solid #f0e2b8;
    border-radius: 14px;
    padding: 12px 14px;
    line-height: 1.4;
}
.cf-head {
    font-weight: 800;
    color: #9a7b1a;
    font-size: 0.92rem;
}
.cf-sub {
    font-size: 0.76rem;
    color: #a08a4a;
    margin: 2px 0 8px;
}
.cf-body {
    background: #fff;
    border: 1px solid #efe6c8;
    border-radius: 10px;
    padding: 6px 12px;
    margin-bottom: 10px;
}
.cf-row {
    display: flex;
    gap: 10px;
    padding: 4px 0;
    border-bottom: 1px dashed #f0ead8;
    font-size: 0.84rem;
}
.cf-row:last-child {
    border-bottom: none;
}
.cf-k {
    flex: 0 0 60px;
    color: #999;
    font-weight: 600;
}
.cf-v {
    flex: 1;
    color: var(--ink);
    font-weight: 600;
    word-break: break-word;
}
.cf-actions {
    display: flex;
    gap: 10px;
}

/* 通知客服填寫表單 */
.nf-body {
    background: #fff;
    border: 1px solid #efe6c8;
    border-radius: 10px;
    padding: 8px 12px;
    margin-bottom: 12px;
}
.nf-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 0;
    border-bottom: 1px dashed #f0ead8;
}
.nf-row:last-child {
    border-bottom: none;
}
.nf-row.nf-need {
    align-items: stretch;
    flex-direction: column;
    gap: 6px;
    padding-bottom: 2px;
}
.nf-row.nf-need .nf-k {
    flex: none;
    width: auto;
    padding-top: 0;
}
.nf-k {
    flex: 0 0 74px;
    color: #999;
    font-weight: 600;
    font-size: 0.82rem;
    padding-top: 2px;
}
.nf-in {
    flex: 1;
    min-width: 0;
    box-sizing: border-box;
    border: 1px solid #e0e4ea;
    border-radius: 6px;
    padding: 6px 8px;
    font-size: 0.84rem;
    font-family: inherit;
    color: var(--ink);
    outline: none;
    transition: border-color 0.15s;
    pointer-events: auto;
    user-select: text;
    -webkit-user-select: text;
}
.nf-in:focus {
    border-color: var(--brand);
}
.nf-in:read-only,
.nf-in:disabled {
    background: #f7f8fa;
    color: #666;
}
.nf-ta {
    resize: vertical;
    min-height: 120px;
    line-height: 1.5;
    width: 100%;
    box-sizing: border-box;
}
.nf-files {
    flex: 1;
    font-size: 0.82rem;
    color: #888;
}
.nf-upload {
    border: 1px dashed var(--brand);
    background: #eef6fc;
    color: var(--brand);
    border-radius: 8px;
    padding: 7px 12px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
}
.nf-upload:hover:not(:disabled) {
    background: #e2eff9;
}
.nf-upload:disabled {
    opacity: 0.5;
    cursor: default;
}
.nf-filelist {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
}
.nf-fchip {
    background: #f4f6f8;
    border: 1px solid #e0e4ea;
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 0.78rem;
    color: var(--ink);
}
.nf-fx {
    color: #c0392b;
    cursor: pointer;
    font-weight: 700;
    margin-left: 2px;
}
.cf-edit,
.cf-send {
    flex: 1;
    padding: 7px 6px;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    border: none;
    line-height: 1.2;
    transition: opacity 0.15s;
}
.cf-edit {
    background: #fff;
    border: 1.5px solid var(--brand);
    color: var(--brand);
}
.cf-send {
    background: var(--brand);
    color: #fff;
}
.cf-edit:hover,
.cf-send:hover {
    opacity: 0.88;
}
.cf-edit:disabled,
.cf-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.tk-head {
    background: linear-gradient(135deg, #1a8a4a, #13a05a);
    color: #fff;
    font-weight: 800;
    font-size: 0.98rem;
    padding: 11px 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.tk-check {
    display: inline-grid;
    place-items: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.25);
    font-size: 0.8rem;
}
.tk-meta {
    font-size: 0.72rem;
    color: #888;
    padding: 8px 16px 4px;
}
.tk-body {
    padding: 4px 16px 12px;
}
.tk-row {
    display: flex;
    gap: 10px;
    padding: 6px 0;
    border-bottom: 1px dashed #eef0f3;
    font-size: 0.86rem;
}
.tk-row:last-child {
    border-bottom: none;
}
.tk-k {
    flex: 0 0 64px;
    color: #888;
    font-weight: 600;
}
.tk-v {
    flex: 1;
    color: var(--ink);
    font-weight: 600;
    word-break: break-word;
}
.tk-foot {
    background: #f5faf6;
    color: #1a8a4a;
    font-size: 0.8rem;
    padding: 10px 16px;
    text-align: center;
    border-top: 1px solid #e6f0e8;
}
.tool-link {
    font-size: 0.78rem;
    color: var(--brand);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-weight: 600;
    transition: opacity 0.15s;
}
.tool-link:hover {
    text-decoration: underline;
}
.attach-btn {
    flex: 0 0 46px;
    width: 46px;
    background: #eaf3f9 !important;
    color: var(--brand) !important;
    font-size: 1.15rem !important;
}
.attach-btn:hover:not(:disabled) {
    background: #d8ebf6 !important;
}
.attach-btn:disabled {
    background: #f1f3f6 !important;
    color: #b6c2d0 !important;
}

/* 自動完成建議 */
.suggest {
    display: none;
    flex-direction: column;
    background: #fff;
    border-top: 1px solid var(--line);
    max-height: 210px;
    overflow-y: auto;
}
.suggest.show {
    display: flex;
}
.suggest .sug {
    padding: 10px 14px;
    font-size: 0.86rem;
    cursor: pointer;
    border-bottom: 1px solid #f0f2f5;
    display: flex;
    align-items: center;
    gap: 9px;
}
.suggest .sug:hover,
.suggest .sug.active {
    background: #eaf3f9;
}
.suggest .sug .sc {
    flex: 0 0 auto;
    font-size: 0.68rem;
    color: #fff;
    background: var(--brand);
    border-radius: 6px;
    padding: 2px 7px;
}
.suggest .sug .sq {
    color: var(--ink);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.suggest .sug .sq b {
    color: var(--brand);
    font-weight: 800;
}
.suggest .sug-empty {
    padding: 11px 14px;
    font-size: 0.82rem;
    color: var(--ink-soft);
}
.file-tray {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 0 12px;
    background: #fff;
}
.file-tray:not(:empty) {
    padding: 10px 12px;
    border-top: 1px solid var(--line);
}
.file-pill {
    display: flex;
    align-items: center;
    gap: 7px;
    background: #eaf3f9;
    border: 1px solid #cfe4f1;
    border-radius: 10px;
    padding: 5px 8px;
    font-size: 0.76rem;
    max-width: 160px;
}
.file-pill .thumb {
    width: 26px;
    height: 26px;
    border-radius: 6px;
    object-fit: cover;
    flex: 0 0 26px;
    background: #cfe4f1;
}
.file-pill .fname {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--ink);
}
.file-pill .rm {
    cursor: pointer;
    color: #9aa7b5;
    font-weight: 700;
    border: none;
    background: none;
    font-size: 0.95rem;
    line-height: 1;
    padding: 0;
}
.file-pill .rm:hover {
    color: #e2554f;
}

/* 訊息中的附件 */
.msg .att {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 6px;
}
.msg .att img {
    max-width: 200px;
    border-radius: 10px;
    border: 1px solid var(--line);
}
.msg .att .doc {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #f1f3f6;
    border-radius: 8px;
    padding: 5px 9px;
    font-size: 0.8rem;
    color: var(--ink);
}

/* 發信卡片 */
.mail-card {
    background: #fff8e8;
    border: 1px solid #f3d98a;
    border-radius: 14px;
    padding: 14px;
    font-size: 0.84rem;
    color: var(--ink);
    align-self: flex-start;
    max-width: 90%;
}
.mail-card strong {
    display: block;
    margin-bottom: 6px;
    color: #9a6b00;
}
.mail-card .mail-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    flex-wrap: wrap;
}
.mail-card button {
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 700;
    border-radius: 9px;
    padding: 8px 14px;
    cursor: pointer;
    border: none;
}
.mail-card .send-mail {
    background: var(--brand);
    color: #fff;
}
.mail-card .send-mail:hover {
    background: var(--brand-deep);
}
.mail-card .copy-mail {
    background: #fff;
    border: 1px solid var(--line) !important;
    color: var(--brand);
}
.mail-card .note {
    margin-top: 9px;
    font-size: 0.74rem;
    color: var(--ink-soft);
    line-height: 1.5;
}

/* 個資同意關卡 */
.consent {
    position: absolute;
    inset: 0;
    top: 76px;
    background: #fff;
    display: none;
    flex-direction: column;
    z-index: 5;
}
.consent.show {
    display: flex;
}
.consent-inner {
    padding: 16px 18px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 9px;
    height: 100%;
}
.consent-icon {
    font-size: 1.3rem;
    text-align: center;
    line-height: 1;
}
.consent h4 {
    font-size: 0.98rem;
    font-weight: 900;
    text-align: center;
    color: var(--brand-deep);
    margin: 0;
}
.consent-lead {
    font-size: 0.78rem;
    color: var(--ink-soft);
    text-align: center;
    line-height: 1.45;
    margin: 0;
}
.consent-box {
    flex: 1;
    min-height: 120px;
    max-height: 46vh;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #f9fafc;
    padding: 14px;
    font-size: 0.78rem;
    line-height: 1.7;
    color: var(--ink-soft);
    overflow-y: auto;
}
.consent-box strong {
    display: block;
    color: var(--ink);
    font-size: 0.84rem;
    margin-bottom: 8px;
}
.consent-check {
    display: flex;
    gap: 9px;
    align-items: flex-start;
    font-size: 0.8rem;
    line-height: 1.5;
    color: var(--ink);
    cursor: pointer;
    transition: opacity 0.2s;
    flex-shrink: 0;
}
.consent-check input {
    margin-top: 3px;
    width: 17px;
    height: 17px;
    flex: 0 0 17px;
    accent-color: var(--brand);
    cursor: pointer;
}
.consent-check.locked {
    opacity: 0.45;
    cursor: not-allowed;
}
.consent-check.locked input {
    cursor: not-allowed;
}
.scroll-hint {
    font-size: 0.76rem;
    color: var(--accent);
    text-align: center;
    font-weight: 700;
    transition: opacity 0.25s;
    animation: hintblink 1.4s ease-in-out infinite;
}
.scroll-hint.done {
    display: none;
}
@keyframes hintblink {
    0%,
    100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}
.btn-consent {
    background: var(--brand);
    color: #fff;
    border: none;
    font-family: inherit;
    font-weight: 700;
    font-size: 0.95rem;
    padding: 13px;
    border-radius: 12px;
    cursor: pointer;
    transition:
        background 0.2s,
        opacity 0.2s;
    flex-shrink: 0;
}
.btn-consent:hover:not(:disabled) {
    background: var(--brand-deep);
}
.btn-consent:disabled {
    background: #b6c2d0;
    cursor: not-allowed;
    opacity: 0.8;
}

@media (max-width: 760px) {
    .chat {
        width: calc(100vw - 24px);
        height: calc(100vh - 24px);
        bottom: 12px;
        right: 12px;
        font-size: 15px;
    }
}

@media screen and (min-width: 1600px) {
    .chat {
        right: 36px;
        bottom: 36px;
        font-size: 18px;
    }
    .chat-head {
        padding: 18px 22px;
    }
    .chat-foot input {
        font-size: 0.95rem;
        padding: 12px 16px;
    }
}
