:root {
    --brand: #1f4e79;
    --brand-dark: #163a5a;
    --brand-light: #e9f0f7;
    --ink: #222;
    --muted: #6b7280;
    --line: #d7dbe0;
    --ok: #1c7c4a;
    --warn: #a4801f;
    --danger: #b02a37;
    --bg: #f4f5f7;
}

html {
    font-size: 15px;
}

body {
    font-family: "Microsoft JhengHei", "PingFang TC", "Segoe UI", Arial, sans-serif;
    color: var(--ink);
    background-color: var(--bg);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

main {
    flex: 1 0 auto;
    padding-bottom: 2rem;
}

a {
    color: var(--brand);
}

/* ---- 頁首 ---- */
.site-header {
    background-color: var(--brand);
    color: #fff;
    border-bottom: 3px solid var(--brand-dark);
}

.site-header .navbar-brand,
.site-header .nav-link {
    color: #fff !important;
}

.site-header .nav-link:hover {
    color: #cfe0f0 !important;
    text-decoration: underline;
}

.site-title {
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

/* ---- 頁尾 ---- */
.site-footer {
    flex-shrink: 0;
    background-color: #ffffff;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 0.85rem;
    padding: 1rem 0;
}

/* ---- 卡片 / 區塊 ---- */
.panel {
    background-color: #fff;
    border: 1px solid var(--line);
    border-radius: 4px;
    margin-bottom: 1.25rem;
}

.panel-head {
    background-color: var(--brand-light);
    border-bottom: 1px solid var(--line);
    padding: 0.65rem 1rem;
    font-weight: 700;
    color: var(--brand-dark);
}

.panel-body {
    padding: 1rem;
}

/* ---- 表單 ---- */
.form-label {
    font-weight: 600;
}

.required::after {
    content: " *";
    color: var(--danger);
}

.field-hint {
    font-size: 0.8rem;
    color: var(--muted);
}

/* ---- 按鈕 ---- */
.btn-brand {
    background-color: var(--brand);
    border-color: var(--brand);
    color: #fff;
}

.btn-brand:hover {
    background-color: var(--brand-dark);
    border-color: var(--brand-dark);
    color: #fff;
}

/* ---- 表格 ---- */
.table thead th {
    background-color: var(--brand-light);
    color: var(--brand-dark);
    border-bottom: 2px solid var(--line);
    white-space: nowrap;
}

.table-hover tbody tr:hover {
    background-color: #f0f4f9;
}

/* ---- 狀態標籤 ---- */
.status {
    display: inline-block;
    padding: 0.15rem 0.6rem;
    border-radius: 3px;
    font-size: 0.82rem;
    font-weight: 600;
    border: 1px solid transparent;
}

.status-pending {
    background-color: #eef1f4;
    color: #55606b;
    border-color: #d2d8de;
}

.status-approved {
    background-color: #e6f4ec;
    color: var(--ok);
    border-color: #b7dcc5;
}

.status-rejected {
    background-color: #fbeaec;
    color: var(--danger);
    border-color: #eac2c7;
}

/* ---- 文件上傳列 ---- */
.doc-row {
    border: 1px solid var(--line);
    border-radius: 4px;
    padding: 0.75rem 1rem;
    margin-bottom: 0.6rem;
    background-color: #fff;
}

.doc-row.has-file {
    border-left: 4px solid var(--ok);
}

.doc-row.no-file {
    border-left: 4px solid var(--line);
}

.doc-name {
    font-weight: 600;
}

.doc-meta {
    font-size: 0.82rem;
    color: var(--muted);
}

/* ---- 截止提示 ---- */
.deadline-banner {
    background-color: #fbeaec;
    border: 1px solid #eac2c7;
    color: var(--danger);
    padding: 0.6rem 1rem;
    border-radius: 4px;
    font-weight: 600;
    margin-bottom: 1rem;
}

.deadline-info {
    background-color: var(--brand-light);
    border: 1px solid #cfe0f0;
    color: var(--brand-dark);
    padding: 0.6rem 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
}

/* ---- 登入/註冊置中卡 ---- */
.auth-card {
    max-width: 460px;
    margin: 2rem auto;
}

.auth-wide {
    max-width: 720px;
}

/* ---- 個資同意書 ---- */
.consent-box {
    white-space: pre-wrap;
    line-height: 1.8;
    max-height: 340px;
    overflow-y: auto;
    padding: 1rem;
    border: 1px solid var(--line);
    border-radius: 4px;
    background-color: #fbfcfd;
    font-size: 0.95rem;
}

/* ---- 徵案首頁 ---- */
.hero {
    background-color: var(--brand);
    color: #fff;
    padding: 2rem 0;
    margin-bottom: 1.5rem;
}

.hero h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
}

.contact-list {
    list-style: none;
    padding-left: 0;
    margin: 0;
}

.contact-list li {
    padding: 0.35rem 0;
    border-bottom: 1px dashed var(--line);
}

.contact-list li:last-child {
    border-bottom: none;
}

.download-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--line);
}

.download-item:last-child {
    border-bottom: none;
}

/* ---- 送出／上傳等待遮罩 ---- */
.busy-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 2000;
    background-color: rgba(255, 255, 255, 0.82);
    align-items: center;
    justify-content: center;
}

.busy-overlay.is-visible {
    display: flex;
}

.busy-box {
    text-align: center;
    padding: 1.8rem 2.4rem;
    background-color: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.12);
    max-width: 90vw;
}

.busy-spinner {
    width: 44px;
    height: 44px;
    margin: 0 auto 1rem;
    border: 4px solid var(--brand-light);
    border-top-color: var(--brand);
    border-radius: 50%;
    animation: busy-spin 0.9s linear infinite;
}

@keyframes busy-spin {
    to {
        transform: rotate(360deg);
    }
}

.busy-text {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--brand);
}

.busy-hint {
    margin-top: 0.4rem;
    font-size: 0.85rem;
    color: var(--muted);
}

/* 尊重使用者的減少動態偏好設定。 */
@media (prefers-reduced-motion: reduce) {
    .busy-spinner {
        animation-duration: 2.4s;
    }
}
