:root {
    --tdk-primary: #2563eb;
    --tdk-primary-dark: #0f2942;
    --tdk-accent: #10b981;
    --tdk-success: #059669;
    --tdk-amber: #f59e0b;
    --tdk-bg: #f8fafc;
}

body {
    font-family: 'Prompt', 'Sarabun', sans-serif;
    background-color: var(--tdk-bg);
    color: #0f172a;
}

.shadow-xs {
    box-shadow: 0 1px 3px rgba(15, 41, 66, 0.06);
}

.brand-icon {
    width: 34px;
    height: 34px;
    background: linear-gradient(135deg, #0f2942, #2563eb);
    font-size: 1.1rem;
}

.promptpay-header {
    background: linear-gradient(135deg, #0f2942, #1d4ed8);
}

.hero-section {
    position: relative;
    overflow: hidden;
    background:
        radial-gradient(circle at 12% 20%, rgba(16, 185, 129, 0.25), transparent 42%),
        radial-gradient(circle at 88% 15%, rgba(37, 99, 235, 0.35), transparent 42%),
        linear-gradient(135deg, #0f2942 0%, #1d4ed8 58%, #059669 100%);
    color: #fff;
}

.hero-section::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image: radial-gradient(rgba(255, 255, 255, 0.08) 1px, transparent 1px);
    background-size: 24px 24px;
    pointer-events: none;
}

.hero-search-box {
    background: rgba(255, 255, 255, 0.98);
    border-radius: 16px;
    padding: 6px;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.28);
}

.hero-search-box .form-control {
    border: 0;
    box-shadow: none !important;
    font-size: 0.98rem;
}

.hero-quick-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    border-radius: 999px;
    font-size: 0.8rem;
    color: #e0f2fe;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.2);
    text-decoration: none;
    transition: all 0.18s ease;
}

.hero-quick-chip:hover {
    background: rgba(255, 255, 255, 0.24);
    color: #fff;
    transform: translateY(-1px);
}

.hero-showcase-tile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.10);
    border: 1px solid rgba(255, 255, 255, 0.18);
    color: #fff;
    text-decoration: none;
    transition: all 0.2s ease;
    backdrop-filter: blur(8px);
}

.hero-showcase-tile:hover {
    background: rgba(255, 255, 255, 0.20);
    border-color: rgba(125, 211, 252, 0.7);
    color: #fff;
    transform: translateX(4px);
}

.tdk-filter-pill {
    border: 1px solid #cbd5e1;
    background: #fff;
    color: #334155;
    border-radius: 999px;
    padding: 8px 16px;
    font-size: 0.88rem;
    font-weight: 500;
    transition: all 0.18s ease;
}

.tdk-filter-pill:hover {
    border-color: var(--tdk-primary);
    color: var(--tdk-primary);
    background: #eff6ff;
}

.tdk-filter-pill.active {
    background: var(--tdk-primary);
    border-color: var(--tdk-primary);
    color: #fff;
    box-shadow: 0 6px 16px rgba(29, 78, 216, 0.25);
}

.tool-card {
    position: relative;
    overflow: hidden;
    transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
    border: 1px solid #e2e8f0;
}

.tool-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--card-accent-1, #2563eb), var(--card-accent-2, #0ea5e9));
    opacity: 0.85;
    transition: height 0.2s ease;
}

.tool-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 18px 36px rgba(15, 23, 42, 0.11);
    border-color: #93c5fd;
}

.tool-card:hover .tool-cta-arrow {
    transform: translateX(4px);
}

.tool-cta-arrow {
    display: inline-block;
    transition: transform 0.18s ease;
}

.tool-icon-box {
    width: 54px;
    height: 54px;
    border-radius: 15px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.55rem;
    flex-shrink: 0;
}

.tool-mini-tag {
    display: inline-block;
    font-size: 0.72rem;
    padding: 3px 9px;
    border-radius: 999px;
    background: #f1f5f9;
    color: #475569;
    font-weight: 500;
}

.tdk-pro-banner {
    background: linear-gradient(135deg, #1e3a8a 0%, #1d4ed8 55%, #0284c7 100%);
    color: #fff;
}

.dropzone-area {
    border: 2px dashed #cbd5e1;
    border-radius: 16px;
    background-color: #f8fafc;
    transition: all 0.2s ease;
    cursor: pointer;
}

.dropzone-area:hover,
.dropzone-area.dragover {
    border-color: var(--tdk-primary);
    background-color: #eff6ff;
}

/* A4 Paper Preview — Always true A4 proportions (794x1123px), scaled proportionally on mobile */
.a4-preview-wrapper {
    position: relative;
    background: #e2e8f0;
    padding: 14px;
    border-radius: 12px;
    overflow: hidden;
}

.a4-page {
    width: 794px !important;
    min-width: 794px !important;
    max-width: 794px !important;
    min-height: 1123px;
    background: #ffffff;
    margin: 0 auto 20px auto;
    padding: 36px 40px;
    box-shadow: 0 4px 18px rgba(15, 23, 42, 0.12);
    position: relative;
    font-family: 'Sarabun', 'Prompt', sans-serif;
    color: #0f172a;
    transform-origin: top left;
    box-sizing: border-box;
}

.a4-page:last-child {
    margin-bottom: 0;
}

.watermark-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    z-index: 20;
}

.watermark-overlay span {
    transform: rotate(-30deg);
    font-size: 2.1rem;
    font-weight: 700;
    color: rgba(220, 38, 38, 0.16);
    border: 4px solid rgba(220, 38, 38, 0.16);
    padding: 12px 28px;
    border-radius: 12px;
    white-space: nowrap;
    user-select: none;
}

.signature-pad {
    border: 1px dashed #94a3b8;
    border-radius: 10px;
    background: #fff;
    touch-action: none;
    cursor: crosshair;
}

.quota-pill {
    font-size: 0.82rem;
    font-weight: 500;
}

.plan-option-btn {
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 10px 14px;
    text-align: left;
    background: #fff;
    transition: all 0.15s ease;
}

.plan-option-btn.active,
.plan-option-btn:hover {
    border-color: var(--tdk-primary);
    background: #eff6ff;
}

.diff-cell-changed {
    background-color: #dcfce7 !important;
    color: #166534;
    font-weight: 500;
}

.diff-cell-old {
    background-color: #fee2e2 !important;
    color: #991b1b;
    text-decoration: line-through;
}

/* PDPA Cookie Consent Banner */
.tdk-cookie-banner {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1080;
    background-color: #2b2f36;
    color: #f1f5f9;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.22);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.tdk-cookie-banner.tdk-cookie-hiding {
    opacity: 0;
    transform: translateY(16px);
}

.text-white-90 {
    color: rgba(255, 255, 255, 0.92);
}

.btn-cookie-teal {
    background-color: #0d9488;
    border-color: #0d9488;
    color: #ffffff;
    font-size: 0.85rem;
}

.btn-cookie-teal:hover {
    background-color: #0f766e;
    border-color: #0f766e;
    color: #ffffff;
}

.btn-cookie-close {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: 0;
    color: #94a3b8;
    font-size: 0.95rem;
    padding: 4px 6px;
    cursor: pointer;
}

.btn-cookie-close:hover {
    color: #ffffff;
}

/* Mobile-First Bottom Navigation Bar */
.tdk-mobile-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1040;
    background: #ffffff;
    border-top: 1px solid #e2e8f0;
    box-shadow: 0 -4px 16px rgba(15, 23, 42, 0.08);
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px)) 4px;
}

.tdk-mnav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    background: transparent;
    border: 0;
    color: #64748b;
    text-decoration: none;
    font-size: 0.72rem;
    font-weight: 500;
    padding: 4px 2px;
    border-radius: 10px;
}

.tdk-mnav-item i {
    font-size: 1.2rem;
    line-height: 1.1;
}

.tdk-mnav-item.active,
.tdk-mnav-item:active {
    color: var(--tdk-primary);
    background-color: #eff6ff;
}

@media (max-width: 991.98px) {
    body {
        padding-bottom: 68px;
    }

    .tdk-cookie-banner {
        bottom: 62px;
    }

    /* Larger tap targets & prevent iOS auto-zoom on form inputs */
    .form-control,
    .form-select {
        font-size: 16px !important;
        min-height: 42px;
    }

    .btn {
        min-height: 40px;
    }

    .btn-sm {
        min-height: 36px;
    }

    .dropzone-area {
        padding: 1.5rem 1rem !important;
    }

    #psTabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    #psTabs .nav-item {
        flex: 0 0 auto !important;
    }
}

.form-control::placeholder,
textarea.form-control::placeholder {
    color: #94a3b8 !important;
    opacity: 1;
}