/* 勞務報酬單系統 - 樣式表 */

:root {
    /* 事務所主色：深藏青，取代原本較像一般 SaaS 產品的亮藍色 */
    --blue-50: #F6F8FA;
    --blue-100: #E8ECF2;
    --blue-200: #CBD3E0;
    --blue-300: #9AA9BE;
    --blue-500: #3E5C7E;
    --blue-600: #1B3F60;
    --blue-700: #13314D;
    /* 玫瑰金點綴，低調用在強調元素上（焦點、重點提示、金額重點） */
    --gold-100: #F5E6E3;
    --gold-500: #B76E79;
    --gold-600: #9C5C66;
    --ink: #232B33;
    --danger: #B3261E;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Microsoft JhengHei", "PingFang TC", "Noto Sans TC", Arial, sans-serif;
    background: linear-gradient(180deg, var(--blue-100) 0%, var(--blue-50) 260px, #ffffff 260px);
    color: var(--ink);
    padding-bottom: 60px;
}

.topbar {
    background: var(--blue-700);
    color: #fff;
    padding: 22px 28px;
    box-shadow: 0 2px 8px rgba(19, 49, 77, 0.25);
}

.topbar h1 {
    margin: 0;
    font-size: 22px;
    letter-spacing: 1px;
}

.topbar p {
    margin: 4px 0 0;
    font-size: 12px;
    opacity: .85;
}

.topbar-content {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-info span {
    font-size: 14px;
}

.btn-logout {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.4);
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-logout:hover {
    background: rgba(255, 255, 255, 0.3);
}

.container {
    max-width: 1400px;
    margin: 24px auto;
    padding: 0 20px;
}

.card {
    background: #fff;
    border: 1px solid var(--blue-200);
    border-radius: 14px;
    box-shadow: 0 4px 16px rgba(19, 49, 77, 0.08);
    padding: 22px 26px;
    margin-bottom: 20px;
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
}

/* 歷史記錄卡片內容較寬（表格欄位多），不套用表單卡片的寬度限制 */
#recordsCard {
    max-width: none;
}

.login-card {
    max-width: 400px;
    margin: 40px auto;
}

.card h2 {
    font-size: 15px;
    color: var(--blue-700);
    margin: 0 0 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--blue-100);
    display: flex;
    align-items: center;
    gap: 8px;
}

.card h2 .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--gold-500);
    display: inline-block;
}

.grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px 18px;
}

.grid .full {
    grid-column: 1 / -1;
}

@media (max-width: 640px) {
    .grid {
        grid-template-columns: 1fr;
    }
    .topbar-content {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
}

.form-group {
    margin-bottom: 16px;
}

label {
    display: block;
    font-size: 12.5px;
    color: #5b6b78;
    margin-bottom: 5px;
    font-weight: 600;
}

label .req {
    color: var(--danger);
    margin-left: 2px;
}

input[type=text],
input[type=number],
input[type=date],
input[type=email],
input[type=password],
select,
textarea {
    width: 100%;
    padding: 9px 11px;
    border: 1.5px solid var(--blue-200);
    border-radius: 8px;
    font-size: 14px;
    background: var(--blue-50);
    transition: border-color 0.15s, background 0.15s;
    font-family: inherit;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--gold-500);
    background: #fff;
}

input[readonly] {
    background: var(--blue-100);
    color: var(--blue-700);
    font-weight: 700;
}

.radio-row {
    display: flex;
    gap: 18px;
    margin-top: 2px;
}

.radio-row label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
    color: var(--ink);
    background: var(--blue-50);
    border: 1.5px solid var(--blue-200);
    padding: 8px 14px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13.5px;
    flex: 1;
    justify-content: center;
}

.radio-row input {
    width: auto;
    margin: 0;
    accent-color: var(--blue-600);
}

.radio-row label.active {
    background: var(--blue-600);
    border-color: var(--blue-600);
    color: #fff;
}

.amount-box {
    background: var(--blue-700);
    border-radius: 12px;
    padding: 18px 20px;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    color: #fff;
}

@media (max-width: 640px) {
    .amount-box {
        grid-template-columns: 1fr 1fr;
    }
}

.amount-box .item {
    text-align: center;
}

.amount-box .item .lbl {
    font-size: 11.5px;
    opacity: .85;
    margin-bottom: 4px;
}

.amount-box .item .val {
    font-size: 19px;
    font-weight: 700;
}

.amount-box .item.net .val {
    color: var(--gold-500);
}

.switch-section {
    display: none;
}

.switch-section.show {
    display: block;
}

.notes {
    background: var(--gold-100);
    border-left: 4px solid var(--gold-500);
    padding: 12px 16px;
    border-radius: 0 8px 8px 0;
    font-size: 11.5px;
    color: #5b6b78;
    line-height: 1.8;
}

.hint {
    font-size: 11.5px;
    color: #5b6b78;
    margin-top: 8px;
}

.actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 6px;
}

.btn-group {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 16px;
}

.link-group {
    text-align: center;
    margin-top: 16px;
}

.link-group a {
    color: var(--blue-600);
    font-size: 13px;
    text-decoration: none;
}

.link-group a:hover {
    text-decoration: underline;
}

button {
    border: none;
    border-radius: 9px;
    padding: 12px 26px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.1s, box-shadow 0.1s;
}

button:active {
    transform: translateY(1px);
}

.btn-primary {
    background: linear-gradient(135deg, var(--blue-600), var(--blue-700));
    color: #fff;
    box-shadow: 0 4px 12px rgba(19, 49, 77, .35);
}

.btn-primary:disabled {
    opacity: .6;
    cursor: not-allowed;
}

.btn-secondary {
    background: #fff;
    color: var(--blue-700);
    border: 1.5px solid var(--blue-300);
}

#resultBox {
    display: none;
    margin-top: 16px;
    padding: 16px 20px;
    border-radius: 10px;
}

#resultBox.ok {
    background: #E8F5E9;
    border: 1px solid #A5D6A7;
    color: #2E7D32;
}

#resultBox.err {
    background: #FFEBEE;
    border: 1px solid #EF9A9A;
    color: #C62828;
}

.msg-box {
    display: none;
    margin-top: 16px;
    padding: 16px 20px;
    border-radius: 10px;
}

.msg-box.ok {
    display: block;
    background: #E8F5E9;
    border: 1px solid #A5D6A7;
    color: #2E7D32;
}

.msg-box.err {
    display: block;
    background: #FFEBEE;
    border: 1px solid #EF9A9A;
    color: #C62828;
}

#resultBox a {
    color: inherit;
    font-weight: 700;
}

.spinner {
    width: 16px;
    height: 16px;
    border: 2.5px solid rgba(255, 255, 255, .5);
    border-top-color: #fff;
    border-radius: 50%;
    display: inline-block;
    animation: spin 0.7s linear infinite;
    vertical-align: -3px;
    margin-right: 6px;
}

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

/* 歷史記錄樣式 */
#recordsList {
    overflow-x: auto;
}

.records-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.records-table th,
.records-table td {
    white-space: nowrap;
}

.records-table th {
    background: var(--blue-100);
    padding: 10px 12px;
    text-align: left;
    font-weight: 600;
    color: var(--blue-700);
    border-bottom: 2px solid var(--blue-200);
}

.records-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--blue-100);
}

.records-table tr:hover {
    background: var(--blue-50);
}

.btn-download {
    background: var(--blue-600);
    color: #fff;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    text-decoration: none;
    display: inline-block;
}

.btn-download:hover {
    background: var(--blue-700);
}

.btn-delete {
    background: var(--blue-600);
    color: #fff;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    text-decoration: none;
    display: inline-block;
}

.btn-delete:hover {
    background: var(--blue-700);
}

.no-records {
    text-align: center;
    color: #5b6b78;
    padding: 20px;
    font-size: 14px;
}

/* 上傳區 */
.upload-box {
    position: relative;
    border: 2px dashed var(--blue-300);
    border-radius: 10px;
    background: var(--blue-50);
    min-height: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    overflow: hidden;
    transition: border-color 0.2s, background 0.2s;
}

.upload-box:hover {
    border-color: var(--blue-600);
    background: var(--blue-100);
}

.upload-box input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    z-index: 2;
}

.upload-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    color: var(--blue-600);
    font-size: 13px;
    z-index: 1;
    pointer-events: none;
}

.upload-icon {
    font-size: 28px;
    font-weight: bold;
    line-height: 1;
}

.upload-box img {
    width: 100%;
    height: 140px;
    object-fit: contain;
    border-radius: 6px;
    z-index: 1;
    pointer-events: none;
}

.upload-filename {
    font-size: 12px;
    color: #5b6b78;
    margin-top: 4px;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.upload-box.has-file {
    border-style: solid;
    border-color: var(--blue-500);
    background: #fff;
}

/* ============ 繳款書資料面板 ============ */
.tax-payment-panel {
    margin-top: 16px;
    padding: 14px 18px;
    background: #FFF8E1;
    border: 1px solid #FFE082;
    border-radius: 8px;
}

.tax-payment-panel h3 {
    margin: 0 0 6px;
    font-size: 15px;
    color: #E65100;
}

.tax-hint {
    font-size: 13px;
    color: #5d4037;
    margin: 0 0 10px;
}

.tax-hint a {
    color: #1565C0;
    text-decoration: underline;
}

.tax-info-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.tax-info-table th {
    text-align: left;
    padding: 5px 10px;
    background: #FFF3E0;
    color: #4E342E;
    border: 1px solid #FFE0B2;
    width: 160px;
    font-weight: 600;
}

.tax-info-table td {
    padding: 5px 10px;
    border: 1px solid #FFE0B2;
    color: #333;
}

.tax-info-table td.amt {
    text-align: right;
    font-weight: 700;
    color: #C62828;
}
