* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: linear-gradient(145deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    color: #e8e8e8;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.container {
    max-width: 560px;
    width: 100%;
}

h1 {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0 0 8px;
    color: #fff;
}

.subtitle {
    font-size: 0.9rem;
    color: #94a3b8;
    margin: 0 0 28px;
}

.upload-section {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.invoice-section {
    display: flex;
    flex-direction: column;
}

.tabs {
    display: inline-flex;
    gap: 8px;
    border-radius: 12px 12px 0 0;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-bottom: none;
}

.tab-button {
    border: none;
    background: transparent;
    color: #cbd5f5;
    font-size: 0.9rem;
    font-weight: 600;
    padding: 14px;
    border-radius: 10px 10px 0 0;
    cursor: pointer;
    transition: background 0.2s, color 0.2s, box-shadow 0.2s;
}

.tab-button:hover {
    background: rgba(59, 130, 246, 0.15);
    color: #fff;
}

.tab-button.is-active {
    background: rgba(59, 130, 246, 0.35);
    color: #fff;
}

.tab-panel.hidden {
    display: none;
}

.manual-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 18px;
    border-radius: 0 0 12px 12px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.manual-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.manual-label {
    font-size: 0.9rem;
    color: #cbd5f5;
}

.manual-input {
    width: 100%;
    padding: 10px 14px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.06);
    color: #e8e8e8;
    font-size: 1rem;
}

.manual-input:focus {
    outline: none;
    border-color: #3b82f6;
}

.manual-input::placeholder {
    color: #64748b;
}

.upload-card {
    border-radius: 0 0 12px 12px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    overflow: hidden;
    border-radius: 12px;
}

.upload-zone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px 24px;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}

.upload-card:last-child {
    border-radius: 0 0 12px 12px;
}

.upload-zone:hover {
    background: rgba(255, 255, 255, 0.06);
}

.upload-zone.drag-over {
    background: rgba(59, 130, 246, 0.15);
    border-color: rgba(59, 130, 246, 0.5);
}

.upload-zone.hidden {
    display: none;
}

.upload-icon {
    font-size: 2.5rem;
    margin-bottom: 8px;
    opacity: 0.9;
}

.upload-label {
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 4px;
}

.upload-hint {
    font-size: 0.8rem;
    color: #94a3b8;
}

.file-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    gap: 12px;
}

.file-info.hidden {
    display: none;
}

.file-name {
    font-size: 0.9rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-info .status {
    font-size: 0.85rem;
    color: #4ade80;
    flex-shrink: 0;
}

.options-section {
    margin-top: 24px;
    padding: 20px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.switch-row {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    user-select: none;
    position: relative;
    justify-content: space-between;
}

/* Тумблер-свіч замість галочки */
.toggle-input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-track {
    position: relative;
    width: 48px;
    height: 26px;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 13px;
    transition: background 0.2s;
}

.toggle-track::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    background: #94a3b8;
    border-radius: 50%;
    transition: transform 0.2s, background 0.2s;
}

.toggle-input:checked + .toggle-track {
    background: rgba(59, 130, 246, 0.5);
}

.toggle-input:checked + .toggle-track::after {
    transform: translateX(22px);
    background: #3b82f6;
}

.switch-label {
    font-size: 1rem;
    font-weight: 500;
}

.tourist-fee-input-wrap {
    margin-top: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.tourist-fee-input-wrap.hidden {
    display: none;
}

.tourist-fee-label {
    font-size: 0.9rem;
    color: #94a3b8;
}

.tourist-fee-input {
    width: 140px;
    padding: 10px 14px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.06);
    color: #e8e8e8;
    font-size: 1rem;
}

.tourist-fee-input:focus {
    outline: none;
    border-color: #3b82f6;
}

.tourist-fee-input::placeholder {
    color: #64748b;
}

.actions {
    margin-top: 28px;
    display: flex;
    justify-content: center;
}

.process-btn {
    width: 100%;
    padding: 18px 32px;
    font-size: 1.25rem;
    font-weight: 600;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: #fff;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.2s, background 0.2s;
    box-shadow: 0 4px 14px rgba(59, 130, 246, 0.4);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.process-btn:hover:not(:disabled):not(.is-loading) {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.5);
}

.process-btn:active:not(:disabled):not(.is-loading) {
    transform: translateY(0);
}

.process-btn:disabled:not(.is-loading) {
    background: #475569;
    cursor: not-allowed;
    opacity: 0.7;
    box-shadow: none;
}

/* Стан обробки: спінер на кнопці та текст */
.process-btn .btn-spinner {
    display: none;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    flex-shrink: 0;
}

.process-btn.is-loading .btn-spinner {
    display: block;
}

.process-btn.is-loading .btn-text {
    opacity: 0.95;
}

.process-btn.is-loading {
    cursor: wait;
    pointer-events: none;
}

.message {
    margin-top: 16px;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 0.9rem;
}

.message-toast {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 999;
    width: min(92vw, 420px);
    transform: translateX(120%);
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
    pointer-events: none;
}

.message-toast.is-visible {
    transform: translateX(0);
    opacity: 1;
    pointer-events: auto;
}

.message-toast.hidden {
    display: none;
}

.message-toast .message {
    margin-top: 0;
    padding: 14px 16px;
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid rgba(148, 163, 184, 0.2);
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
}

.message.error {
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
}

.message.success {
    background: rgba(34, 197, 94, 0.2);
    color: #86efac;
}

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