@import url("https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.7.2/css/all.min.css");

/* ===========================================================================
   Design tokens（2026/08/18 建立）
   ---------------------------------------------------------------------------
   全站的文字色、字級、背景、框線都從這裡取，日後要微調只改這一個地方。
   註解裡的數字是該色在白底上的對比度，WCAG AA 內文需 ≥ 4.5。
   =========================================================================== */
:root {
    /* ---- 文字：四階，2026/08/19 二度加深 ----
       括號內是「對白底 / 對頁面底 #eef1f5」的對比度。
       最淺的第四階也有 8.5，遠高於 AA 內文要求的 4.5，小字不會再糊。 */
    --text-1: #101a24;   /* 17.6 / 15.5  標題、強調、金額 */
    --text-2: #1d2d3d;   /* 14.0 / 12.4  一般內文、表格內容 */
    --text-3: #2a3c4e;   /* 11.3 / 10.0  欄位標籤 */
    --text-4: #3c4f61;   /*  8.5 /  7.5  次要說明、小字（最初 4.6，偏灰） */

    /* ---- 品牌藍 ---- */
    --brand: #0f4c81;        /*  8.9:1  標題藍、選單 */
    --brand-strong: #0b3a63; /* 更深，用於 hover／按下 */
    --brand-accent: #1a6bb0; /*  5.6:1  連結、重點數值 */
    --brand-soft: #e8f1fb;   /* 淺藍底 */

    /* ---- 背景與框線 ---- */
    --bg-page: #eef1f5;    /* 頁面底，與白色卡片有明確層次 */
    --bg-sunken: #e7ebf1;  /* 更凹陷的區塊 */
    --bg-subtle: #f5f7fa;  /* 表頭、淺色列 */
    --card: #fff;
    --line: #d3dce5;       /* 一般框線 */
    --line-soft: #e6ecf2;  /* 淡框線、分隔線 */
    --field-line: #b6c6d4; /* 輸入框框線，要看得出來 */

    /* ---- 字級：七階，2026/08/19 二度放大 ----
       括號內是最初的值。維持原本的階梯比例，版面比例不變，只是整體再好讀一點。
       每一階都乘上 --fs-scale，讓右上角的「字體大小」可以整組放大縮小。 */
    --fs-scale: 1;
    --fs-xs: calc(13.5px * var(--fs-scale));  /* 說明小字（12） */
    --fs-sm: calc(14px * var(--fs-scale));    /* 欄位標籤（13） */
    --fs-md: calc(14.5px * var(--fs-scale));  /* 表格、表單內文（13.5） */
    --fs-base: calc(16px * var(--fs-scale));  /* 一般內文（14） */
    --fs-lg: calc(18px * var(--fs-scale));    /* 小標題（16） */
    --fs-xl: calc(20px * var(--fs-scale));    /* 卡片／彈窗標題（18） */
    --fs-2xl: calc(22px * var(--fs-scale));   /* 頁面標題（20） */

    /* ---- 相容：舊變數對應到新的，既有規則不會失效 ---- */
    --text: var(--text-2);
    --muted: var(--text-4);
    --bg: var(--bg-page);
    --navy: #203a54;
    --green: #1e7058;
    --green-dark: #175a47;
    --mint: #e7f5eb;
}

/* ---------------------------------------------------------------------------
   字體大小切換（右上角的 小／中／大）
   ---------------------------------------------------------------------------
   由 js/core/font-scale.js 在 <html> 掛上 data-font-scale，選擇存在瀏覽器裡。
   「中」就是目前這一版，不設任何值，所以沒開過這個功能的人畫面完全不變。
   rem 也一起跟著調，因為還有 40 幾條樣式是用 rem 指定字級的。
   ------------------------------------------------------------------------- */
:root[data-font-scale="small"] {
    --fs-scale: .87;
    font-size: 13.9px;   /* 預設 16px × .87 */
}

:root[data-font-scale="large"] {
    --fs-scale: 1.25;
    font-size: 20px;     /* 預設 16px × 1.25 */
}

* {
    box-sizing: border-box
}

body {
    margin: 0;
    background: var(--bg-page);
    color: var(--text-2);
    font: var(--fs-base)/1.6 "Noto Sans TC", Arial, sans-serif
}
.water-login {
    min-height: 100vh;
    margin: 0;
    font-family: "Noto Sans TC", Arial, sans-serif;
    background: #edf4f4 url("../assets/login-background.png") center center / cover no-repeat;
    color: #33435a;
}
.sidebar {
    position: fixed;
    z-index: 2;
    width: 245px;
    top: 0;
    bottom: 0;
    background: #fff;
    border-right: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    transition: .25s ease
}

.brand {
    height: 72px;
    padding: 0 25px;
    display: flex;
    align-items: center;
    gap: 11px;
    border-bottom: 1px solid #eef1f3;
    color: var(--navy);
    font-size: var(--fs-xl);
    font-weight: 700
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 31px;
    height: 31px;
    color: #fff;
    background: var(--green);
    border-radius: 8px
}

.sidebar nav {
    padding: 22px 13px
}

.nav-item {
    width: 100%;
    border: 0;
    background: transparent;
    border-radius: 7px;
    text-align: left;
    padding: 12px 15px;
    margin-bottom: 5px;
    color: var(--text-3);
    font: 500 15px inherit;
    cursor: pointer;
    transition: .2s
}

a.nav-item {
    display: block;
    text-decoration: none
}

.nav-item:hover {
    background: #f0f6f3
}

.nav-item.active {
    background: #e4f3ea;
    color: var(--green-dark);
    font-weight: 700
}

.nav-icon {
    font-size: var(--fs-2xl);
    display: inline-block;
    margin-right: 11px
}

.user-panel {
    margin: auto 15px 18px;
    padding: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    background: #f7faf8;
    border-radius: 9px
}

.avatar {
    display: grid;
    place-items: center;
    width: 33px;
    height: 33px;
    background: #d3eadf;
    color: var(--green-dark);
    border-radius: 50%;
    font-weight: 700
}

.user-panel strong,
.user-panel small {
    display: block
}

.user-panel small {
    font-size: var(--fs-xs);
    color: var(--muted)
}

.page-shell {
    min-height: 100vh;
    margin-left: 245px;
    transition: .25s ease
}

.topbar {
    height: 72px;
    padding: 0 31px;
    display: flex;
    align-items: center;
    gap: 16px;
    background: #fff;
    border-bottom: 1px solid var(--line)
}

.menu-button {
    border: 1px solid #cdd7df;
    border-radius: 6px;
    background: #fff;
    width: 32px;
    height: 32px;
    padding: 6px;
    cursor: pointer
}

.menu-button i {
    display: block;
    height: 2px;
    background: var(--navy);
    margin: 3px
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 9px;
    color: var(--text-4)
}

.breadcrumb strong {
    font-size: var(--fs-xl);
    color: var(--navy)
}

.breadcrumb b {
    padding: 3px 8px;
    border: 1px solid #bce5c9;
    background: #ecfaf0;
    border-radius: 4px;
    color: #24854d;
    font-size: var(--fs-xs);
    font-weight: 500
}

.top-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 18px
}

.notice {
    position: relative;
    border: 0;
    background: transparent;
    color: var(--text-4);
    font-size: var(--fs-2xl)
}

.notice em {
    position: absolute;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #e94b5a;
    top: 3px;
    right: 1px
}

.profile {
    border: 0;
    border-left: 1px solid #e3e8eb;
    background: transparent;
    padding-left: 18px;
    color: var(--text-3)
}

.content {
    max-width: none;
    margin: auto;
    padding: 30px
}

.page-intro {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 23px
}

.eyebrow {
    margin: 0 0 3px;
    color: var(--green);
    font-size: var(--fs-xs);
    letter-spacing: .08em;
    font-weight: 700
}

.page-intro h1,
.empty-card h1 {
    margin: 0;
    color: var(--navy);
    font-size: 25px
}

.page-intro p:not(.eyebrow),
.empty-card p:not(.eyebrow) {
    margin: 5px 0 0;
    color: var(--muted)
}

button {
    font: inherit
}

.primary-button,
.secondary-button {
    height: 36px;
    padding: 0 16px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600
}

.primary-button {
    border: 1px solid var(--green);
    background: var(--green);
    color: #fff;
    box-shadow: 0 2px 4px #1e705822
}

.primary-button:hover {
    background: var(--green-dark)
}

.card {
    border: 1px solid var(--line);
    border-radius: 9px;
    background: var(--card);
    overflow: hidden;
    margin-bottom: 17px
}

.card-heading {
    height: 46px;
    padding: 0 17px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid #e4e9ed;
    background: #fafbfc;
    color: var(--navy)
}

.search-symbol {
    font-size: var(--fs-2xl);
    color: var(--brand-accent);
    margin-right: 8px
}

.collapse {
    margin-left: auto;
    border: 0;
    background: transparent;
    color: var(--text-4);
    cursor: pointer
}

.search-form {
    display: grid;
    grid-template-columns: 1.3fr 1.3fr .5fr auto;
    gap: 18px;
    align-items: end;
    padding: 20px 17px
}

.search-form label {
    color: var(--text-3);
    font-size: var(--fs-sm)
}

.search-form input,
.search-form select {
    width: 100%;
    height: 36px;
    margin-top: 6px;
    padding: 0 11px;
    border: 1px solid #cad5de;
    border-radius: 6px;
    background: #fff;
    color: var(--text-2);
    font: 14px inherit
}

.form-actions {
    display: flex;
    gap: 8px
}

.secondary-button {
    border: 1px solid #cfd9e1;
    background: #fff;
    color: var(--text-3)
}

.table-toolbar {
    min-height: 57px;
    padding: 10px 17px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #e4e9ed;
    color: var(--text-2)
}

.table-toolbar b {
    color: var(--navy)
}

.table-toolbar>div {
    display: flex;
    gap: 10px
}

.small {
    height: 34px
}

.table-wrap {
    overflow-x: auto
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 930px
}

th {
    height: 36px;
    background: #fafbfc;
    color: var(--text-3);
    text-align: left;
    font-size: var(--fs-xs);
    font-weight: 600;
    border-bottom: 1px solid var(--line)
}

td {
    height: 55px;
    border-bottom: 1px solid #e8edf0;
    color: var(--text-3)
}

th,
td {
    padding: 0 15px
}

tbody tr {
    transition: .15s
}

tbody tr:hover {
    background: #f2f9f4
}

tbody tr.highlight {
    background: var(--mint)
}

.code {
    font: 12px Consolas, monospace;
    color: var(--brand)
}

.project-link {
    color: var(--brand-accent);
    cursor: pointer
}

.unit {
    color: var(--text-3)
}

.amount {
    font-weight: 600;
    color: var(--brand)
}

.align-right {
    text-align: right
}

.status {
    display: inline-block;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: var(--fs-xs);
    font-weight: 700
}

.status.enabled {
    color: #16824b;
    background: #dff8e7
}

.status.draft {
    color: var(--text-4);
    background: #f0f2f4
}

.row-actions {
    white-space: nowrap
}

.delete,
.edit {
    height: 29px;
    padding: 0 12px;
    border-radius: 4px;
    background: #fff;
    cursor: pointer;
    font: 13px inherit
}

a.edit {
    display: inline-flex;
    align-items: center;
    text-decoration: none
}

.delete {
    border: 1px solid #ffb8bd;
    color: #ce3f4c;
    margin-right: 5px
}

.edit {
    border: 1px solid #f7bf69;
    color: #9a671d;
    background: #fffaf0
}

.pagination {
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    padding: 0 17px;
    color: var(--text-4)
}

.pagination span {
    margin-right: 10px
}

.pagination button {
    width: 28px;
    height: 28px;
    border: 1px solid #d4dde4;
    background: #fff;
    border-radius: 5px;
    color: var(--text-4)
}

.pagination .current {
    background: var(--green);
    border-color: var(--green);
    color: white
}

.empty-module {
    display: grid;
    min-height: calc(100vh - 72px);
    place-items: center;
    padding: 30px
}

.empty-card {
    width: min(580px, 100%);
    padding: 58px 35px;
    text-align: center;
    background: white;
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: 0 8px 25px #203a5409
}

.empty-icon {
    margin: 0 auto 16px;
    display: grid;
    place-items: center;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: #e6f4ec;
    color: var(--green);
    font-size: 30px
}

.empty-card span {
    display: inline-block;
    margin-top: 22px;
    padding: 4px 12px;
    border-radius: 20px;
    background: #edf5f0;
    color: var(--green);
    font-size: var(--fs-xs)
}

.toast {
    position: fixed;
    bottom: 25px;
    left: 50%;
    transform: translate(-50%, 20px);
    opacity: 0;
    pointer-events: none;
    background: #233d56;
    color: #fff;
    padding: 10px 18px;
    border-radius: 7px;
    box-shadow: 0 5px 15px #0002;
    transition: .25s
}

.toast.show {
    transform: translate(-50%, 0);
    opacity: 1
}

.sidebar.collapsed {
    transform: translateX(-245px)
}

.page-shell.expanded {
    margin-left: 0
}

@media(max-width:850px) {
    .sidebar {
        transform: translateX(-245px)
    }

    .page-shell {
        margin-left: 0
    }

    .sidebar.open {
        transform: none
    }

    .topbar {
        padding: 0 18px
    }

    .content {
        padding: 22px 16px
    }

    .search-form {
        grid-template-columns: 1fr 1fr
    }

    .form-actions {
        justify-content: flex-end
    }

    .top-actions {
        display: none
    }
}

@media(max-width:560px) {
    .page-intro {
        align-items: flex-start;
        gap: 15px;
        flex-direction: column
    }

    .search-form {
        grid-template-columns: 1fr
    }

    .table-toolbar {
        align-items: flex-start;
        gap: 10px;
        flex-direction: column
    }

    .table-toolbar>div {
        width: 100%
    }

    .table-toolbar button {
        flex: 1;
        padding: 0 7px
    }

    .breadcrumb span {
        display: none
    }

    .breadcrumb strong {
        font-size: var(--fs-base)
    }
}
