:root {
    --bg-color: #f7f9fc;
    --primary-color: #1a73e8;
    --primary-dark: #1557b0;
    --secondary-color: #34a853;
    --text-color: #202124;
    --border-color: #dadce0;
    --card-bg: #fff;
    --slip-bg: #fff;
    --slip-brand: #1a73e8;
    --slip-text: #3c4043;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    overflow-x: hidden;
    width: 100%;
}
body {
    font-family: 'Noto Sans TC', system-ui, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    margin: 0;
    padding: 0;
}

#app {
    width: 100%;
    max-width: 700px;
    margin: 0 auto;
    padding: 15px;
    box-sizing: border-box;
}

/* Utilities */
.text-center { text-align: center; }
.align-end { align-items: flex-end; }
.full-width { grid-column: 1 / -1; }

/* Stepper */
.stepper {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
    background: transparent;
    padding: 10px 0;
}
.step {
    flex: 1;
    text-align: center;
    font-size: 0.85em;
    color: #9aa0a6;
    position: relative;
    font-weight: 500;
}
.step.active {
    color: var(--primary-color);
    font-weight: 700;
}

/* Views */
.view {
    display: none;
    animation: fadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
.view.active {
    display: block;
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(15px); }
    to { opacity: 1; transform: translateY(0); }
}
.view-title {
    margin-bottom: 25px;
    font-size: 1.6rem;
    font-weight: 700;
    color: #202124;
}

/* Forms & UI */
.form-section {
    background: var(--card-bg);
    padding: 24px;
    border-radius: 16px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.03);
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
}
.section-title {
    font-size: 1.1rem;
    color: var(--primary-color);
    margin-bottom: 15px;
    font-weight: 600;
    border-bottom: 2px solid #e8eaed;
    padding-bottom: 8px;
}
.form-row {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
}
@media (max-width: 600px) {
    .form-row {
        flex-direction: column;
    }
    .grid-4-to-2 {
        grid-template-columns: 1fr 1fr !important;
    }
}
.grid-4-to-2 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}
.form-group {
    display: flex;
    flex-direction: column;
}
.row-group {
    flex-direction: row;
    align-items: center;
    gap: 10px;
}
label {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: #3c4043;
    display: flex;
    align-items: center;
    gap: 4px;
}
input[type="text"], input[type="tel"], input[type="date"], input[type="time"], input[type="number"], .modern-select, input[type="password"] {
    padding: 10px 14px;
    border: 1.5px solid #e0e4e9;
    border-radius: 10px;
    font-size: 16px; /* 蝣箔???iOS 銝??芸?蝮格 */
    font-family: inherit;
    background: #fff;
    transition: all 0.2s;
    width: 100%;
    box-sizing: border-box; /* Crucial for overflow fix */
}
input:focus, .modern-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(26,115,232,0.1);
}

/* 撘瑁矽憿舐內?蝯?憿撓?交?嚗甇Ｗ?閮撓??*/
#input-amount {
    border: 2.5px solid #f29900 !important; /* 擙株?璈??脤?獢?*/
    background-color: #fffaf0 !important; /* 璆菜楚璈? */
    font-weight: 700;
    color: #e65100;
    font-size: 1.1rem;
}

#input-amount::placeholder {
    color: #ffb74d;
    font-weight: 500;
}

#input-amount:focus {
    border-color: #ff6d00 !important;
    box-shadow: 0 0 0 4px rgba(255, 152, 0, 0.2) !important;
    background-color: #ffffff !important;
}

/* 強調顯示主要時間(出發/抵達) */
#input-main-time {
    font-size: 1.4rem !important;
    font-weight: 800;
    color: var(--primary-color);
    background-color: #f1f6ff;
    border-color: #aecbfa;
}
.short-input { width: 80px !important; flex: none; }

/* Radio Cards (Service Type) */
.radio-group-modern {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    width: 100%;
}
@media (max-width: 600px) {
    .radio-group-modern {
        grid-template-columns: 1fr 1fr;
    }
}
.radio-card {
    position: relative;
    cursor: pointer;
    width: 100%;
    display: block;
}
.radio-card input {
    position: absolute;
    opacity: 0;
}
.rc-content {
    background: #fff;
    border: 1.5px solid #e0e4e9;
    border-radius: 12px;
    padding: 15px 5px;
    text-align: center;
    font-weight: 700;
    color: #444;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 100px; /* Increased height for better mobile touch */
    width: 100%;
    box-sizing: border-box;
}
.rc-icon {
    font-size: 2.2rem; /* Much larger icons as requested */
    line-height: 1;
}
.rc-text {
    font-size: 1rem;
    white-space: nowrap;
}
.radio-card input:checked + .rc-content {
    border-color: var(--primary-color);
    background: #f1f6ff;
    color: var(--primary-color);
    box-shadow: 0 4px 15px rgba(26,115,232,0.15);
    border-width: 2px;
}

.ai-box {
    background: #fff;
    border-radius: 12px;
    padding: 25px;
    border: 1px solid #d2e3fc;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
}
.ai-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}
.ai-box h3 {
    margin: 0;
    color: #1a73e8;
    font-size: 1.2rem;
}
.ai-box p {
    font-size: 0.92rem;
    color: #5f6368;
    margin-bottom: 15px;
}
.settings-icon {
    font-size: 0.85rem;
    text-decoration: none;
    color: #5f6368;
}
.settings-panel {
    background: rgba(255,255,255,0.8);
    padding: 15px;
    border-radius: 8px;
    margin: 10px 0;
}
.settings-desc { font-size: 0.8rem; color: #555; }
.file-modern {
    background: #fff;
    padding: 10px;
    border-radius: 8px;
    border: 1px dashed #aecbfa;
    width: 100%;
}
.ai-status { margin-top: 10px; font-size: 0.9rem; font-weight: 600; color: #188038; }

/* Buttons */
.form-actions { display: flex; gap: 15px; justify-content: center; margin-top: 20px; }
.dashboard-actions { display: flex; flex-direction: column; gap: 12px; margin-top: 25px; }
button {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}
.btn-primary { background: var(--primary-color); color: #fff; }
.btn-primary:active { opacity: 0.8; }
.btn-secondary { background: var(--secondary-color); color: #fff; }
.btn-outline { background: transparent; border: 2px solid var(--border-color); color: #3c4043; }
.btn-dark { background: #202124; color: #fff; }
.btn-large { padding: 16px 32px; font-size: 1.1rem; border-radius: 12px; width: 100%; box-shadow: 0 4px 12px rgba(26,115,232,0.3); }
.btn-block { width: 100%; padding: 15px; text-align: left; }
.icon-btn { display: flex; align-items: center; gap: 10px; font-size: 1.05rem; }
.text-link { color: var(--primary-color); text-decoration: none; font-size: 0.9rem; font-weight: 500; }

.btn-modify-form {
    background: #fff;
    color: #1a73e8;
    border: 1.5px solid #aecbfa;
    transition: all 0.2s ease;
}
.btn-modify-form:hover {
    background: #f4f8fe;
    border-color: #1a73e8;
    color: #1557b0;
    box-shadow: 0 2px 8px rgba(26,115,232,0.1);
}


/* Dashboard & Status */
.status-card {
    background: #fff;
    border-radius: 16px;
    padding: 30px;
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}
.status-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}
.badge {
    background: #feefc3;
    color: #e37400;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 700;
}
.badge.signed { background: #e6f4ea; color: #137333; }
.instruction-text { color: #5f6368; font-size: 0.95rem; }
.action-divider {
    text-align: center;
    position: relative;
    margin: 10px 0;
}
.action-divider::before {
    content: '';
    position: absolute;
    top: 50%; left: 0; right: 0;
    border-top: 1px dashed #dadce0;
    z-index: 1;
}
.action-divider span {
    background: #fff;
    padding: 0 10px;
    color: #9aa0a6;
    font-size: 0.8rem;
    position: relative;
    z-index: 2;
}

/* Canvas */
.canvas-container {
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    background-color: #f8f9fa;
    height: 350px;
    width: 100%;
    margin-bottom: 20px;
    position: relative;
}
#signature-canvas { position: absolute; top:0; left:0; width:100%; height:100%; cursor: crosshair; touch-action: none; }

/* =========================================
   BEAUTIFIED SLIP DESIGN
========================================= */
.slip-wrapper {
    background: #e8eaed;
    padding: 20px;
    border-radius: 16px;
    overflow-x: auto;
}
.slip-container {
    background: var(--slip-bg);
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    padding: 40px;
    border-radius: 8px; /* Look like paper */
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    color: var(--slip-text);
}
.slip-actions-topbar {
    display: flex;
    background: #fff;
    padding: 10px 15px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    margin-bottom: 20px;
    border-radius: 8px;
}

body.slip-fullscreen {
    background: #e8eaed;
}

body.slip-fullscreen #app {
    padding: 0;
    max-width: 100%;
}

body.slip-fullscreen .top-nav,
body.slip-fullscreen .stepper,
body.slip-fullscreen .feedback-container,
body.slip-fullscreen .main-version-footer {
    display: none !important;
}

body.slip-fullscreen .slip-actions-topbar {
    border-radius: 0;
    margin-bottom: 0;
}

body.slip-fullscreen .slip-wrapper {
    border-radius: 0;
    padding: 15px;
    min-height: calc(100vh - 60px);
}

/* Slip Header */
.slip-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    border-bottom: 3px solid var(--slip-brand);
    padding-bottom: 20px;
    margin-bottom: 25px;
}
.slip-brand { display: flex; align-items: center; gap: 18px; }
.logo-placeholder {
    width: 60px;
    height: 60px;
    background: var(--slip-brand);
    color: #fff;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.2rem;
}
.slip-logo {
    height: 75px; 
    width: auto;
    max-width: 180px;
    object-fit: contain; /* Using contain to ensure 'MAMBA RENTAL' isn't cut off */
    border-radius: 8px;
}
.slip-title-text h1 {
    font-size: 2.2rem;
    margin: 0;
    letter-spacing: 2px;
    color: #202124;
}
.slip-title-text p {
    font-size: 0.85rem;
    color: #80868b;
    margin: 2px 0 0;
    letter-spacing: 3px;
    font-family: 'Montserrat', sans-serif;
}
.slip-meta { text-align: right; }
.meta-tag {
    display: inline-block;
    background: #e8f0fe;
    color: var(--slip-brand);
    padding: 6px 12px;
    border-radius: 6px;
    font-weight: 700;
    font-size: 1.1rem;
    margin-bottom: 5px;
}
.meta-date { font-size: 0.9rem; color: #5f6368; }

/* Slip Body & Cards */
.slip-card {
    border: 1px solid #e8eaed;
    border-radius: 8px;
    margin-bottom: 20px;
    overflow: hidden;
}
.card-title {
    background: #f8f9fa;
    padding: 14px 20px;
    margin: 0;
    font-size: 1.2rem;
    color: #202124;
    border-bottom: 1px solid #e8eaed;
    font-weight: 700;
}
.card-title span { color: #9aa0a6; font-size: 0.95rem; margin-left: 8px; font-weight: 500; }
.grid-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
}
.grid-item {
    padding: 18px 20px;
    border-bottom: 1px solid #e8eaed;
    border-right: 1px solid #e8eaed;
    display: flex;
    flex-direction: column;
}
.grid-item:nth-child(even) { border-right: none; }
.grid-content.two-col .grid-item { border-right: 1px solid #e8eaed; }
.grid-content.two-col .grid-item:nth-child(even) { border-right: none; }

.highlight-row { background: #fef7e0; border-bottom: 1px solid #e8eaed !important; border-right: none !important;}
.label { font-size: 0.95rem; color: #5f6368; margin-bottom: 6px; font-weight: 500; }
.value { font-size: 1.25rem; font-weight: 700; color: #202124; word-break: break-all; }
.thin-tag { font-weight: 400; color: #5f6368; font-size: 0.9rem; }
.car-plate { letter-spacing: 1px; font-family: 'Montserrat', sans-serif; }

/* Route Display inside Grid */
.route-display {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 100%;
}
.route-display .point {
    display: flex;
    flex-direction: column;
    width: 100%;
    padding-left: 18px;
    border-left: 4px solid #1a73e8;
    position: relative;
}
.route-display .point.is-start { border-left-color: #34a853; }
.route-display .point.is-end { border-left-color: #ea4335; }
.route-display .time { 
    color: var(--slip-brand); 
    font-weight: 800; 
    margin-left: 8px; 
    font-size: 1.4rem;
}
.route-arrow { display: none; }

.price-row {
    padding: 20px;
    background: #f8f9fa;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.price-row .label { font-size: 1rem; color: #202124; font-weight: 600; margin: 0; }
.price-value { font-size: 1.5rem; color: #1e8e3e; font-family: 'Montserrat', sans-serif; }

/* Signature Area */
.signature-section {
    display: flex;
    gap: 20px;
    margin-top: 30px;
}
.sign-box {
    flex: 1;
    border: 1px solid #dadce0;
    border-radius: 8px;
    height: 180px;
    position: relative;
    background: #fff;
}
.sign-label {
    position: absolute;
    top: -12px;
    left: 15px;
    background: #fff;
    padding: 0 8px;
    font-size: 0.85rem;
    color: #5f6368;
    font-weight: 600;
}
.unsigned-text { color: #d93025; font-weight: 400; font-size: 0.8rem; }
.stamp-container {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 15px 5px 5px 5px; /* Reduced padding to maximize space, leaving room for the label at the top */
}
.company-stamp-box img {
    max-width: 100%;
    max-height: 150px;
    width: auto;
    height: auto;
    object-fit: contain;
    opacity: 0.95;
    mix-blend-mode: multiply;
}
.passenger-sign-box img {
    max-width: 100%;
    max-height: 150px;
    width: auto;
    height: auto;
    object-fit: contain;
}

.slip-footer {
    margin-top: 30px;
    text-align: center;
    font-size: 0.85rem;
    color: #9aa0a6;
    border-top: 1px solid #e8eaed;
    padding-top: 15px;
}

/* Constraint Utilities */
input, select, textarea { max-width: 100%; box-sizing: border-box; }
.modern-select { text-overflow: ellipsis; }
.slip-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.slip-container { 
    max-width: 800px; 
    margin: 0 auto;
}
@media (min-width: 801px) {
    .slip-container { min-width: 750px; }
}

@media (max-width: 600px) {
    #app { 
        padding: 10px; 
        width: 100%; 
        overflow-x: hidden; 
        display: block;
    }
    .form-section { padding: 15px; margin-bottom: 15px; border-radius: 12px; }
    .stepper { font-size: 0.82em; padding: 5px 0; }
    
    .form-row { 
        flex-direction: column !important; 
        gap: 12px !important; 
        align-items: stretch !important; 
    }
    .form-group, .form-group.full-width { 
        width: 100% !important; 
        flex: none !important;
    }
    
    /* Ensure inputs never exceed screen width and have proper font size */
    input, select, textarea {
        max-width: 100% !important;
        box-sizing: border-box !important;
        font-size: 16px !important; 
    }
    
    .radio-group-modern { 
        grid-template-columns: 1fr 1fr !important; 
        gap: 10px !important; 
    }
    
    .btn-outline {
        padding: 10px 12px;
    }
    
    .form-actions {
        flex-direction: column;
        gap: 12px;
    }
    .form-actions button {
        width: 100%;
    }
    
    .totals-row-inner {
        gap: 8px !important;
        padding: 0 10px !important;
    }
    
    .grid-content {
        grid-template-columns: 1fr !important;
    }
    .grid-item {
        border-right: none !important;
    }
}

.totals-row-inner {
    display: flex;
    gap: 15px;
    height: 44px;
    align-items: center;
    padding: 0 15px;
}

@media (orientation: landscape) and (max-height: 600px) {
    .canvas-container { height: 65vh; margin-bottom: 10px; }
    .view-title { margin-bottom: 10px; font-size: 1.3rem; }
}

/* Navigation Top Bar */
.top-nav { display: flex; gap: 10px; margin-bottom: 15px; padding-bottom: 10px; border-bottom: 1px solid var(--border-color); }
.btn-topnav { flex: 1; padding: 12px; border-radius: 8px; font-size: 1rem; font-weight: 600; cursor: pointer; background: #fff; border: 1px solid var(--border-color); color: #444; }
.btn-topnav.primary-nav { background: var(--primary-color); color: #fff; border-color: var(--primary-color); }

/* History View */
.history-list-container { display: flex; flex-direction: column; gap: 15px; padding-bottom: 30px; }
.history-card { background: #fff; border: 1px solid var(--border-color); border-radius: 8px; padding: 15px; box-shadow: 0 2px 4px rgba(0,0,0,0.02); }
.h-card-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.h-card-top strong { color: var(--primary-color); font-size: 1.1rem; }
.h-card-mid { font-size: 1.2rem; font-weight: 600; margin-bottom: 8px; }
.h-card-bot { color: #666; font-size: 0.95rem; margin-bottom: 12px; }
/* Disclaimer Overlay */
.disclaimer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* Premium background images with responsive handling */
    background: url('bg-desktop.png') center bottom / cover no-repeat;
    z-index: 9999;
    display: none; /* Hidden by default, shown by JS */
    align-items: center;
    justify-content: center;
    padding: 20px;
}

/* Semi-transparent dark overlay to ensure text legibility */
.disclaimer-overlay::before {
    content: '';
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.2);
    z-index: 0;
}

@media (max-width: 768px) {
    .disclaimer-overlay {
        background: url('bg-mobile.png') center bottom / cover no-repeat;
    }
}

.disclaimer-content {
    background: rgba(255, 255, 255, 0.9); /* Semi-transparent for glass effect */
    backdrop-filter: blur(12px); /* Glassmorphism blur */
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    border-radius: 24px;
    padding: 30px;
    overflow-y: auto;
    position: relative;
    z-index: 1; /* Keep above the dark overlay */
    box-shadow: 0 20px 40px rgba(0,0,0,0.5), 0 0 20px rgba(255,255,255,0.2);
    display: flex;
    flex-direction: column;
}

.disclaimer-title {
    text-align: center;
    color: var(--primary-color);
    font-size: 1.5rem;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f0f0f0;
}

.disclaimer-body {
    font-size: 0.95rem;
    line-height: 1.7;
    color: #444;
}

.disclaimer-body ol {
    padding-left: 20px;
    margin-bottom: 20px;
}

.disclaimer-body li {
    margin-bottom: 10px;
}

.disclaimer-warning {
    background: linear-gradient(135deg, #fff5f5 0%, #fff1f0 100%);
    border: 2px solid #ffccc7;
    border-left: 8px solid #ff4d4f;
    padding: 20px;
    border-radius: 12px;
    margin: 25px 0;
    color: #cf1322;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(255, 77, 79, 0.1);
}

.disclaimer-warning strong {
    color: #a8071a;
    font-size: 1.25rem;
    display: block;
    margin-bottom: 8px;
    text-shadow: 0 1px 1px rgba(0,0,0,0.05);
}

.main-version-footer {
    text-align: center;
    padding: 20px 0;
    font-size: 0.85rem;
    color: #9aa0a6;
    font-family: 'Montserrat', sans-serif;
}

.authorized-list {
    margin-top: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 12px;
}

.authorized-list h3 {
    font-size: 1rem;
    color: #333;
    margin-bottom: 8px;
}

.authorized-list p {
    font-weight: 700;
    color: var(--primary-color);
    font-size: 1.1rem;
}

.disclaimer-actions {
    margin-top: 30px;
}

.version-footer {
    text-align: center;
    margin-top: 20px;
    font-size: 0.8rem;
    color: #999;
    font-family: 'Montserrat', sans-serif;
}

@media (max-width: 600px) {
    .disclaimer-content {
        padding: 20px;
        border-radius: 16px;
    }
}

.feedback-container {
    display: flex;
    justify-content: center;
    margin-top: 10px;
}

.btn-feedback {
    font-size: 0.9rem;
    padding: 8px 16px;
    border-color: #d1d9e6;
    color: #5f6368;
    background: #fff;
    border-radius: 20px;
}

.btn-feedback:hover {
    background: #f8f9fa;
    border-color: #aecbfa;
    color: var(--primary-color);
}

.feedback-modal-content {
    max-width: 500px;
}
/* Calculation Row Styling */
.calculation-row {
    background: #fcfdfe;
    border: 1.5px solid #dce2e8;
    padding: 20px;
    border-radius: 14px;
    margin-top: 15px;
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 15px;
}
@media (max-width: 600px) {
    .calculation-row {
        grid-template-columns: 1fr;
    }
}

.modern-select-fixed {
    width: 90px !important;
    min-width: 90px !important;
    flex-shrink: 0;
}

/* AI Trigger Enhancements */
.ai-trigger-container {
    display: flex;
    justify-content: center;
    margin: 10px 0 25px;
}
.ai-trigger-btn {
    background: linear-gradient(135deg, #1a73e8 0%, #1557b0 100%);
    color: #fff;
    padding: 12px 30px;
    border-radius: 50px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(26,115,232,0.25);
    font-weight: 700;
    font-size: 1rem;
    border: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.ai-trigger-btn:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 8px 25px rgba(26,115,232,0.35);
}

/* Grid helper for forms */
.form-grid-3 {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 15px;
}
@media (max-width: 600px) {
    .form-grid-3 {
        grid-template-columns: 1fr;
    }
}

.modern-select-fixed {
    width: 100px !important;
    min-width: 100px !important;
    flex: none !important;
}

/* 新增亮眼提醒文字樣式 */
.slip-reminder-row {
    margin-top: 15px;
    padding: 12px;
    background: linear-gradient(135deg, #fff5f5 0%, #fff0f0 100%);
    border: 2px solid #ff4d4f;
    border-radius: 12px;
    color: #d93025;
    font-weight: 800;
    font-size: 1.2rem;
    text-align: center;
    box-shadow: 0 4px 15px rgba(217, 48, 37, 0.1);
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    animation: flash-border 2s infinite;
}

@keyframes flash-border {
    0% { border-color: #ff4d4f; }
    50% { border-color: #ffa39e; }
    100% { border-color: #ff4d4f; }
}

/* =========================================
   DASHBOARD & STATS STYLES
   ========================================= */
.dashboard-grid {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-top: 15px;
}

.stat-card {
    background: var(--card-bg);
    border-radius: 16px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03);
    border: 1.5px solid var(--border-color);
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Card custom schemes */
.stat-card.completed {
    border-left: 6px solid #34a853;
    background: linear-gradient(135deg, #ffffff 0%, #f4faf6 100%);
}
.stat-card.uncompleted {
    border-left: 6px solid #1a73e8;
    background: linear-gradient(135deg, #ffffff 0%, #f4f8fe 100%);
}
.stat-card.revenue {
    border-left: 6px solid #f29900;
    background: linear-gradient(135deg, #ffffff 0%, #fffaf0 100%);
}
.stat-card.unpaid {
    border-left: 6px solid #ea4335;
    background: linear-gradient(135deg, #ffffff 0%, #fff7ed 100%);
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
}

.stat-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 18px 20px 10px;
}

.stat-card-icon {
    font-size: 1.6rem;
}

.stat-card-header h3 {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 700;
    color: #202124;
}

.stat-period-grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.stat-period-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    padding: 15px 20px 20px;
}

.stat-period-item {
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 12px;
    padding: 12px 10px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.01);
    position: relative;
    overflow: hidden;
}

/* Highlight Hover and Active States */
.completed .stat-period-item:hover {
    background: #e6f4ea;
    border-color: #34a853;
    transform: scale(1.03);
}
.uncompleted .stat-period-item:hover {
    background: #e8f0fe;
    border-color: #1a73e8;
    transform: scale(1.03);
}
.revenue .stat-period-item:hover {
    background: #fef7e0;
    border-color: #f29900;
    transform: scale(1.03);
}

.period-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: #5f6368;
    display: block;
    margin-bottom: 6px;
}

.period-value {
    font-size: 1.15rem;
    font-weight: 800;
    color: #202124;
    display: block;
}

.completed .period-value {
    color: #137333;
}
.uncompleted .period-value {
    color: #1a73e8;
}
.revenue .period-value {
    color: #b06000;
    font-family: 'Montserrat', sans-serif;
}

.period-value-container {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.period-estimate {
    font-size: 0.75rem;
    color: #70757a;
    margin-top: 2px;
    font-weight: 600;
}

.click-hint {
    font-size: 0.72rem;
    color: #9aa0a6;
    display: block;
    margin-top: 6px;
    opacity: 0;
    transition: opacity 0.2s;
    font-weight: 500;
}

.stat-period-item:hover .click-hint {
    opacity: 1;
}

/* Stats Detail Table Styling */
.stats-table th {
    padding: 12px 10px;
    border-bottom: 2px solid var(--border-color);
}

.stats-table td {
    padding: 12px 10px;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.stats-table tbody tr {
    transition: background 0.15s ease;
}

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

@media (max-width: 600px) {
    .top-nav {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 12px;
    }
    .btn-topnav {
        flex: 0 0 auto;
        white-space: nowrap;
        padding: 10px 15px !important;
        font-size: 0.95rem !important;
    }
    .stat-period-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    .stat-period-item {
        padding: 10px;
        display: flex;
        justify-content: space-between;
        align-items: center;
        text-align: left;
    }
    .period-label {
        margin-bottom: 0;
    }
    .period-value-container {
        align-items: flex-end;
    }
    .period-estimate {
        font-size: 0.7rem;
        margin-top: 2px;
    }
    .click-hint {
        display: none;
    }
}

/* =========================================
   MOBILE RESPONSIVE DIALOG STATS STYLES
   ========================================= */
@media (max-width: 600px) {
    .disclaimer-content {
        padding: 20px 15px !important;
        border-radius: 16px !important;
        max-height: 95vh !important;
    }

    /* Hide the original desktop table header */
    .stats-table thead {
        display: none;
    }
    
    /* Transform table elements into cards */
    .stats-table, 
    .stats-table tbody, 
    .stats-table tr, 
    .stats-table td {
        display: block !important;
        width: 100% !important;
        box-sizing: border-box;
    }
    
    .stats-table tr {
        background: #fdfdfd;
        border: 1.5px solid #e8eaed !important;
        border-radius: 14px;
        padding: 12px 14px;
        margin-bottom: 14px;
        box-shadow: 0 4px 8px rgba(0,0,0,0.01);
        position: relative;
        overflow: hidden;
    }
    
    .stats-table td {
        border-bottom: none !important;
        padding: 4px 0 !important;
        text-align: left !important;
        font-size: 0.95rem;
    }
    
    /* Date and Time as a Card Header */
    .stats-table td.cell-date-time {
        font-size: 1rem;
        font-weight: 700;
        color: var(--primary-color);
        border-bottom: 1.5px dashed #e8eaed !important;
        padding-bottom: 8px !important;
        padding-right: 70px !important; /* Prevent overlapping with the absolutely positioned amount */
        margin-bottom: 8px;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    
    /* Absolutely position the Amount at the top right to prevent overlapping */
    .stats-table td.cell-amount {
        font-size: 1.2rem !important;
        font-weight: 800;
        color: #e65100;
        position: absolute;
        top: 15px;
        right: 14px;
        padding: 0 !important;
        margin-top: 0 !important;
        float: none !important;
        width: auto !important;
        z-index: 10;
    }
    
    /* Service Type badge */
    .stats-table td.cell-type {
        display: inline-block !important;
        width: auto !important;
        margin-right: 6px;
        vertical-align: middle;
    }
    
    .stats-table td.cell-type .badge {
        font-size: 0.8rem !important;
        padding: 2px 8px !important;
    }
    
    /* Passenger details */
    .stats-table td.cell-passenger {
        display: inline-block !important;
        width: auto !important;
        font-weight: 700;
        color: #202124;
        vertical-align: middle;
    }
    
    /* Route bubble */
    .stats-table td.cell-route {
        color: #5f6368;
        font-size: 0.85rem;
        background: #f1f3f4;
        padding: 8px 12px !important;
        border-radius: 10px;
        margin-top: 8px;
        white-space: normal !important; /* Allow natural address wrapping */
        max-width: 100% !important;
        text-overflow: unset !important;
        overflow: visible !important;
    }
}

/* =========================================
   VEHICLE EXPENSES & NET INCOME STYLES
   ========================================= */
.stat-card.expenses {
    border-left: 6px solid #d93025;
    background: linear-gradient(135deg, #ffffff 0%, #fdf4f4 100%);
}

.stat-card.net-income {
    border-left: 6px solid #12b5cb;
    background: linear-gradient(135deg, #ffffff 0%, #f0fbfc 100%);
}

.expenses .stat-period-item:hover {
    background: #fce8e6;
    border-color: #d93025;
    transform: scale(1.03);
}

.unpaid .stat-period-item:hover {
    background: #fce8e6;
    border-color: #ea4335;
    transform: scale(1.03);
}

.net-income .stat-period-item:hover {
    background: #e4f7f9;
    border-color: #12b5cb;
    transform: scale(1.03);
}

/* Net Income custom coloring based on positive/negative */
.period-value.positive {
    color: #137333 !important;
}
.period-value.negative {
    color: #c5221f !important;
}

/* Expenses management view styling */
.expense-form-card {
    background: #ffffff;
    border: 1.5px solid var(--border-color);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 25px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.02);
}

.expense-form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 15px;
}

.expense-list-section {
    background: #ffffff;
    border: 1.5px solid var(--border-color);
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.02);
}

.expense-item-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    border-bottom: 1px solid #f1f3f4;
    transition: background-color 0.2s ease;
}

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

.expense-item-card:hover {
    background-color: #f8f9fa;
}

.expense-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.expense-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 700;
    text-align: center;
    width: fit-content;
}

/* Badge colors for categories */
.badge-maintenance { background: #feefe3; color: #b06000; } /* 保養 */
.badge-repair { background: #fce8e6; color: #c5221f; } /* 維修 */
.badge-mod { background: #f3e8fd; color: #8430d9; } /* 改裝 */
.badge-refuel { background: #eaf1fb; color: #1a73e8; } /* 加油 */
.badge-etc { background: #e6f4ea; color: #137333; } /* ETC */
.badge-tax1 { background: #fef7e0; color: #b06000; } /* 燃料稅 */
.badge-tax2 { background: #fce8e6; color: #c5221f; } /* 牌照稅 */
.badge-parking { background: #e4f7f9; color: #007b83; } /* 停車費 */
.badge-inspect { background: #e8f0fe; color: #1a73e8; } /* 檢驗費 */

.expense-meta {
    font-size: 0.82rem;
    color: #5f6368;
}

.expense-notes {
    font-size: 0.9rem;
    color: #202124;
    font-weight: 500;
}

.expense-amount-action {
    display: flex;
    align-items: center;
    gap: 15px;
}

.expense-amount {
    font-family: 'Montserrat', sans-serif;
    font-size: 1.15rem;
    font-weight: 800;
    color: #c5221f;
}

/* Mobile responsive styles for expenses view */
@media (max-width: 600px) {
    .expense-item-card {
        flex-direction: column;
        align-items: flex-start;
        position: relative;
        padding: 12px 14px;
        gap: 10px;
    }
    
    .expense-amount-action {
        width: 100%;
        justify-content: space-between;
        border-top: 1.5px dashed #f1f3f4;
        padding-top: 10px;
        margin-top: 2px;
    }
    
    .expense-form-grid {
        grid-template-columns: 1fr;
    }
    
    .settings-card-home {
        padding: 16px;
        margin-top: 20px;
        border-radius: 12px;
    }
    
    .settings-upload-zone {
        padding: 15px;
        border-radius: 10px;
    }
}

/* =========================================
   HOME SETTINGS CARD BEAUTIFICATION
   ========================================= */
.settings-card-home {
    background: linear-gradient(135deg, #ffffff 0%, #f9f6fc 100%);
    border-radius: 16px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03);
    border: 1.5px solid var(--border-color);
    border-left: 6px solid #7c4dff; /* Indigo/Purple accent border to match gear icon */
    padding: 24px;
    margin-top: 25px;
    width: 100%;
    box-sizing: border-box;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.settings-card-home:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
}

.settings-upload-zone {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 20px;
    border: 1.5px solid #e0e0e0;
    box-sizing: border-box;
    margin-top: 15px;
    transition: all 0.2s ease;
}

.settings-upload-zone:hover {
    border-color: #aecbfa;
    background: #fbfcfe;
}

/* =========================================
   NEW RESTURED PASSENGER & ITINERARY STYLES
   ========================================= */

/* Primary Passenger Badge */
.passenger-primary-badge {
    background: linear-gradient(135deg, #ffe082 0%, #ffb300 100%);
    color: #5d4037;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 0.78rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    box-shadow: 0 2px 5px rgba(255,179,0,0.2);
    border: 1px solid #ffa000;
}

/* Table Style for Passengers in Slip */
.passenger-slip-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 5px;
    margin-bottom: 5px;
}
.passenger-slip-table th {
    background: #f8f9fa;
    color: #5f6368;
    text-align: left;
    padding: 10px 14px;
    font-size: 0.88rem;
    font-weight: 600;
    border-bottom: 1.5px solid #dadce0;
}
.passenger-slip-table td {
    padding: 12px 14px;
    border-bottom: 1px solid #e8eaed;
    font-size: 0.98rem;
    color: #202124;
    vertical-align: top;
}
.passenger-slip-table tr:last-child td {
    border-bottom: none;
}
.passenger-slip-table td .passenger-name {
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}
.passenger-slip-table td .passenger-phone {
    font-size: 0.85rem;
    color: #5f6368;
    margin-top: 3px;
}
.passenger-slip-table td .passenger-phone a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
}
.passenger-slip-table td .passenger-addr {
    font-weight: 600;
    color: #202124;
}
.passenger-slip-table td .passenger-pax-count {
    background: #eaf1fb;
    color: var(--primary-color);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.82rem;
    font-weight: 700;
}

/* Quick Fill Buttons in Form */
.btn-quick-fill {
    padding: 4px 8px;
    font-size: 0.78rem;
    font-weight: 700;
    border-radius: 6px;
    background-color: #f4f8fe;
    border: 1px solid #aecbfa;
    color: var(--primary-color);
    cursor: pointer;
    transition: all 0.2s ease;
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 2px;
}
.btn-quick-fill:hover {
    background-color: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
}

/* Clean Itinerary Section */
.clean-itinerary-box {
    background: #fdfefe;
    border-radius: 8px;
    border: 1px solid #e8eaed;
    overflow: hidden;
}
.clean-itinerary-header {
    background: #f8f9fa;
    padding: 12px 16px;
    font-weight: 700;
    color: #202124;
    border-bottom: 1.5px solid #e8eaed;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.clean-itinerary-timeline {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    position: relative;
}
.clean-itinerary-step {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    position: relative;
}
.clean-itinerary-step::before {
    content: '';
    position: absolute;
    top: 24px;
    left: 12px;
    bottom: -24px;
    width: 2px;
    background: #dadce0;
    z-index: 1;
}
.clean-itinerary-step:last-child::before {
    display: none;
}
.clean-itinerary-node {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid #dadce0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.78rem;
    font-weight: 700;
    color: #5f6368;
    z-index: 2;
    flex-shrink: 0;
}
.clean-itinerary-step.is-active .clean-itinerary-node {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background: #eaf1fb;
}
.clean-itinerary-step.is-start .clean-itinerary-node {
    border-color: #34a853;
    color: #34a853;
    background: #e6f4ea;
}
.clean-itinerary-step.is-end .clean-itinerary-node {
    border-color: #ea4335;
    color: #ea4335;
    background: #fce8e6;
}
.clean-itinerary-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.clean-itinerary-label {
    font-size: 0.82rem;
    color: #5f6368;
    font-weight: 600;
}
.clean-itinerary-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: #202124;
}
.clean-itinerary-meta {
    font-size: 0.85rem;
    color: #5f6368;
}

/* Card layout for multi-passenger inputs */
.passenger-input-card {
    background: #fbfcfe;
    border: 1.5px solid #e3ecf9;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
    transition: all 0.2s ease;
}
.passenger-input-card:hover {
    box-shadow: 0 4px 12px rgba(26,115,232,0.04);
    border-color: #aecbfa;
}
.passenger-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    border-bottom: 1px solid #eff4fd;
    padding-bottom: 8px;
}




