:root {
    --primary: #6366f1;
    --success: #10b981;
}

body {
    font-family: system-ui, sans-serif;
    background: linear-gradient(135deg, #e0c3fc 0%, #8ec5fc 100%);
    margin: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
}

.glass {
    background: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(20px);
    border-radius: 30px;
    border: 1px solid white;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.1);
    width: 95%;
    max-width: 600px;
    padding: 35px;
    margin-top: 50px;
    box-sizing: border-box;
}

.header {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 25px;
    gap: 8px;
    /* 約半個中文字距離 */
}

.logo {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 2px solid white;
    flex-shrink: 0;
}

h1 {
    font-size: clamp(30px, 7.5vw, 42px);
    color: #333;
    white-space: nowrap;
    margin: 0;
}

h2 {
    text-align: center;
}

input {
    width: 100%;
    padding: 12px 20px;
    margin: 10px 0;
    border-radius: 10px;
    border: none;
    font-size: 15px;
    box-sizing: border-box;
}

.btn {
    padding: 12px 20px;
    border-radius: 10px;
    border: none;
    background: var(--primary);
    color: white;
    cursor: pointer;
    font-weight: bold;
    font-size: 15px;
    width: 100%;
    margin-top: 10px;
    transition: 0.2s;
}

.btn.green {
    background: var(--success);
}

.btn:hover {
    transform: scale(1.02);
}

.btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.pass-wrap {
    position: relative;
}

.eye {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
}

.dropdown {
    display: none;
    position: absolute;
    top: 110%;
    right: 0;
    background: white;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    width: 220px;
    overflow: hidden;
    z-index: 1000;
}

.dropdown.show {
    display: block;
}

.dropdown button {
    display: block;
    width: 100%;
    padding: 10px 18px;
    text-align: left;
    border: none;
    background: none;
    font-size: 14px;
    cursor: pointer;
}

.dropdown button:hover {
    background: #f0f4f8;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    z-index: 2000;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: white;
    border-radius: 25px;
    padding: 25px;
    width: 95%;
    max-width: 650px;
    position: relative;
}

.modal-content.small {
    max-width: 400px;
}

.center {
    text-align: center;
}

.close {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 26px;
    cursor: pointer;
    color: #aaa;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}

td,
th {
    padding: 12px;
    border-bottom: 1px solid #eee;
    text-align: left;
    font-size: 18px;
}

.table-scroll {
    max-height: 60vh;
    overflow-y: auto;
}

.footer {
    margin-top: auto;
    padding: 30px;
    font-size: 13.5px;
    color: #444;
}

.hidden {
    display: none;
}

.red-text {
    color: red !important;
}

@media (max-width: 600px) {
    h1 {
        font-size: 22px;
        white-space: normal;
    }

    .glass {
        padding: 25px;
    }
}

.link {
    color: var(--primary);
    text-decoration: underline;
    cursor: pointer;
    text-align: center;
    margin-top: 15px;
    font-weight: bold;
}

#loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(5px);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

#loader.hidden {
    display: none;
}

/* Toast 提示系統 */
#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
}

.toast {
    background: white;
    padding: 15px 25px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    animation: slideIn 0.3s ease forwards;
    border-left: 5px solid var(--primary);
    min-width: 200px;
}

.toast.error {
    border-left-color: #ff4d4d;
}

.toast.success {
    border-left-color: #00c853;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes fadeOut {
    to {
        transform: translateX(20px);
        opacity: 0;
    }
}

/* 微動畫與細節優化 */
.glass {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.glass:hover {
    box-shadow: 0 12px 40px 0 rgba(31, 38, 135, 0.45);
}

.btn {
    transition: all 0.2s ease;
}

.btn:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
}

input {
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.spinner {
    width: 60px;
    height: 60px;
    border: 6px solid rgba(99, 102, 241, 0.2);
    border-radius: 50%;
    border-top-color: var(--primary);
    animation: spin 1s ease-in-out infinite;
}

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

#nav-tools {
    position: relative;
}

/* 表單優化樣式 */
.form-item {
    text-align: left;
    margin-bottom: 20px;
}

.form-item label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #666;
    margin-bottom: 8px;
    margin-left: 5px;
}

.form-item input,
.form-item select {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    transition: all 0.3s ease;
}

.form-item input:focus,
.form-item select:focus {
    background: white;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

select {
    width: 100%;
    padding: 11px 15px;
    border-radius: 10px;
    border: 1px solid #ddd;
    font-size: 15px;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23333'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 15px center;
    background-size: 18px;
}

pre#inv-res {
    background: #f1f5f9;
    padding: 15px;
    border-radius: 12px;
    border: 1px dashed #cbd5e1;
    font-family: monospace;
    font-size: 14px;
    color: #475569;
    margin-top: 20px;
}