:root{
    --bg:#f7f3e8;
    --panel:#ffffff;
    --panel-2:#fcfaf4;
    --text:#1f2937;
    --muted:#6b7280;
    --line:#dfe5dd;

    --primary:#2e5e3e;
    --primary-hover:#244a31;
    --primary-soft:#e4f0e8;

    --accent:#d9c8a2;
    --accent-soft:#efe6d1;

    --success:#2f7d4a;
    --danger:#c94b4b;
    --danger-hover:#a73b3b;

    --shadow:0 10px 28px rgba(0,0,0,.06);
    --radius:16px;
}

*{
    box-sizing:border-box;
}

html,body{
    margin:0;
    padding:0;
}

body{
    font-family:"Segoe UI","Microsoft JhengHei",sans-serif;
    background:var(--bg);
    color:var(--text);
    line-height:1.6;
    font-size:14px;
}

a{
    color:inherit;
    text-decoration:none;
}

.container{
    max-width:1200px;
    margin:28px auto;
    padding:0 20px 30px;
}

/* ===== 共用標題 ===== */
h1,h2,h3,h4{
    margin:0 0 12px 0;
    color:var(--text);
    letter-spacing:.2px;
    font-weight:700;
}

h1{
    font-size:28px;
}
h2{
    font-size:22px;
}
h3{
    font-size:18px;
}
h4{
    font-size:16px;
}

p{
    margin:0 0 10px 0;
}

hr{
    border:none;
    border-top:1px solid var(--line);
    margin:20px 0;
}

/* ===== 卡片 ===== */
.card{
    background:var(--panel);
    border:1px solid var(--line);
    border-radius:var(--radius);
    box-shadow:var(--shadow);
    padding:24px;
    margin-bottom:20px;
}

.readonly-box{
    background:var(--panel-2);
    border:1px dashed #cbbd98;
    border-radius:12px;
    padding:12px 14px;
    word-break:break-all;
}

/* ===== 頂部操作列 ===== */
.topnav{
    display:flex;
    flex-wrap:wrap;
    gap:10px;
    margin-bottom:20px;
}

/* ===== 按鈕 ===== */
button,
.btn{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    min-height:42px;
    padding:10px 16px;
    border:none;
    border-radius:12px;
    background:var(--primary);
    color:#fff;
    font-size:14px;
    font-weight:600;
    cursor:pointer;
    transition:all .2s ease;
}

.btn-hr-edit{
    background:#2563eb;
    color:#fff !important;
    border:1px solid #1d4ed8;
}
.btn-hr-edit:hover{
    background:#1d4ed8;
    color:#fff !important;
}

button:hover,
.btn:hover{
    background:var(--primary-hover);
    transform:translateY(-1px);
}

button:disabled,
.btn:disabled{
    opacity:.6;
    cursor:not-allowed;
    transform:none;
}

.btn-secondary{
    background:#7a7a7a;
}
.btn-secondary:hover{
    background:#616161;
}

.btn-success{
    background:var(--success);
}
.btn-success:hover{
    background:#25663c;
}

.btn-danger{
    background:var(--danger);
}
.btn-danger:hover{
    background:var(--danger-hover);
}

/* ===== 表單 ===== */
label{
    display:block;
    margin:10px 0 6px;
    font-size:14px;
    font-weight:700;
    color:#374151;
}

input,
select,
textarea{
    width:100%;
    border:1px solid #d6ddd2;
    border-radius:12px;
    background:#fff;
    padding:11px 12px;
    font-size:14px;
    color:var(--text);
    outline:none;
    transition:border-color .2s ease, box-shadow .2s ease, background .2s ease;
}

input::placeholder,
textarea::placeholder{
    color:#9ca3af;
}

input:focus,
select:focus,
textarea:focus{
    border-color:var(--primary);
    background:#fff;
    box-shadow:0 0 0 4px rgba(46,94,62,.10);
}

textarea{
    min-height:100px;
    resize:vertical;
}

input[type="checkbox"],
input[type="radio"]{
    width:auto;
    margin-right:6px;
    accent-color:var(--primary);
}

.small{
    font-size:13px;
    color:var(--muted);
}

/* ===== 排版 ===== */
.inline-grid{
    display:grid;
    grid-template-columns:1fr 1fr;
    gap:16px;
}

.inline-grid-3{
    display:grid;
    grid-template-columns:1fr 1fr 1fr;
    gap:16px;
}

.field-inline{
    display:flex;
    align-items:center;
    gap:10px;
}

.field-inline label{
    margin:0;
    font-weight:600;
}

.section-title{
    margin-top:28px;
    margin-bottom:14px;
    padding-bottom:8px;
    font-size:18px;
    border-bottom:2px solid #e8dec3;
}

.page-title{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:12px;
    margin-bottom:16px;
}

.page-title h1,
.page-title h2{
    margin-bottom:0;
}

/* ===== 表格 ===== */
.table{
    width:100%;
    border-collapse:collapse;
    background:#fff;
    border:1px solid var(--line);
    border-radius:14px;
    overflow:hidden;
}

.table th,
.table td{
    padding:12px 14px;
    border-bottom:1px solid var(--line);
    text-align:left;
    vertical-align:top;
    font-size:14px;
}

.table th{
    background:var(--primary-soft);
    color:#244a31;
    font-weight:700;
}

.table tr:hover td{
    background:#fbfcf9;
}

.table tr:last-child td{
    border-bottom:none;
}

/* ===== 提示訊息 ===== */
.alert{
    padding:12px 14px;
    border-radius:12px;
    margin-bottom:14px;
    font-size:14px;
    border:1px solid transparent;
}

.alert-success{
    background:#e8f3eb;
    color:#1f5e36;
    border-color:#c9dfd0;
}

.alert-danger{
    background:#fff1f1;
    color:#9f2f2f;
    border-color:#efc7c7;
}

.alert-info{
    background:#f5f0df;
    color:#6b5a2b;
    border-color:#e6dbb7;
}

/* ===== 統計卡 / 面板 ===== */
.stat-grid{
    display:grid;
    grid-template-columns:1fr 1fr;
    gap:20px;
}

.stat-card{
    background:linear-gradient(180deg,#ffffff 0%, #fcfaf4 100%);
    border:1px solid var(--line);
    border-radius:18px;
    box-shadow:var(--shadow);
    padding:24px;
}

.stat-card .label{
    color:var(--muted);
    font-size:13px;
    margin-bottom:8px;
}

.stat-card .value{
    font-size:32px;
    font-weight:700;
    color:var(--primary);
}

/* ===== badge ===== */
.badge{
    display:inline-flex;
    align-items:center;
    padding:4px 10px;
    border-radius:999px;
    font-size:12px;
    font-weight:700;
    line-height:1.2;
}

.badge-pending{
    background:#f5f0df;
    color:#7a6223;
}

.badge-success{
    background:#e8f3eb;
    color:#1f5e36;
}

.badge-danger{
    background:#fff1f1;
    color:#9f2f2f;
}

.badge-muted{
    background:#f1f3f5;
    color:#6b7280;
}

/* ===== 登入頁小調整 ===== */
.login-card{
    max-width:480px;
    margin:50px auto;
}

/* ===== 響應式 ===== */
@media (max-width: 900px){
    .inline-grid,
    .inline-grid-3,
    .stat-grid{
        grid-template-columns:1fr;
    }
}

@media (max-width: 640px){
    .container{
        padding:0 14px 20px;
        margin:18px auto;
    }

    .card,
    .stat-card{
        padding:18px;
    }

    h1{
        font-size:24px;
    }
    h2{
        font-size:20px;
    }
    h3{
        font-size:17px;
    }

    .topnav{
        flex-direction:column;
    }

    button,
    .btn{
        width:100%;
    }
}