* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

input,
select,
textarea {
    color: #000 !important;
}

input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
    -webkit-text-fill-color: #000 !important;
    -webkit-box-shadow: 0 0 0px 1000px white inset !important;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #0080C9 0%, #6B7280 100%);
    min-height: 100vh;
    padding: 20px;
}

.hidden {
    display: none !important;
}

/* Hidden enrichment button */
.hidden-enrich-btn {
    display: none !important;
}

/* Logotipo stiliai */
.logo-upload-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: flex-start;
}

.logo-preview {
    max-width: 200px;
    max-height: 100px;
}

.logo-preview img {
    max-width: 200px;
    max-height: 100px;
    object-fit: contain;
    border: 1px solid #ddd;
    border-radius: 5px;
    padding: 5px;
    background: white;
}

.print-logo-container {
    text-align: center;
    margin-bottom: 15px;
    width: 100%;
    display: flex;
    justify-content: center;
}

.print-logo-container img {
    max-width: 180px;
    max-height: 80px;
    object-fit: contain;
}

/* Aplikacijos logotipo konteineris */
.invoice-logo-container {
    text-align: center;
    margin: 0 auto 20px auto;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.invoice-logo-container img {
    max-height: 132px;
    width: auto;
    object-fit: contain;
    display: block;
    margin: 0 auto;
}

/* Tarpas po datos */
.date-spacing {
    height: 50px;
}

/* Prekių pavadinimų autocomplete */
.item-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ccc;
    border-top: none;
    border-radius: 0 0 5px 5px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    max-height: 150px;
    overflow-y: auto;
    display: none;
}

.item-suggestion {
    padding: 8px 10px;
    cursor: pointer;
    font-size: 13px;
}

.item-suggestion:hover,
.item-suggestion.selected {
    background: #e9ecef;
}

.invoice-table-editor input[readonly],
.invoice-table-editor input[disabled] {
    background: #f3f4f6;
    color: #666 !important;
    cursor: not-allowed;
}

.vat-rate-select {
    margin-left: 6px;
    padding: 2px 6px;
    font-size: 12px;
}

/* Prisijungimo stiliai */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 40px);
}

.login-box {
    background: white;
    padding: 40px;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.login-box h1 {
    margin-bottom: 30px;
    color: #333;
}

.hint {
    margin-top: 15px;
    color: #888;
    font-size: 12px;
}

/* Pagrindinė aplikacija */
#mainApp {
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    max-width: 1200px;
    margin: 0 auto;
    overflow: hidden;
}

header {
    background: linear-gradient(135deg, #6B7280 0%, #4B5563 100%);
    color: white;
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 64px;
}

header h1 {
    font-size: 1.25rem;
    margin: 0;
    color: white;
}

.header-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

/* Skirtukai */
.tabs {
    display: flex;
    background: #f5f5f5;
    border-bottom: 2px solid #ddd;
}

.tab-btn {
    flex: 1;
    padding: 15px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 16px;
    color: #666;
    transition: all 0.3s;
}

.tab-btn:hover {
    background: #e0e0e0;
}

.tab-btn.active {
    background: white;
    color: #0080C9;
    font-weight: bold;
    border-bottom: 3px solid #0080C9;
}

.tab-content {
    display: none;
    padding: 30px;
}

.tab-content.active {
    display: block;
}

/* Formos stiliai */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #333;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.3s;
    color: #000 !important;
    height: 38px;
}

.form-group input:-webkit-autofill,
.form-group input:-webkit-autofill:hover,
.form-group input:-webkit-autofill:focus {
    -webkit-text-fill-color: #000 !important;
    -webkit-box-shadow: 0 0 0px 1000px white inset !important;
    color: #000 !important;
}

.form-group input::placeholder {
    color: #999;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #0080C9;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

@media (max-width: 768px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

/* Mygtukai */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(135deg, #0080C9 0%, #0060A0 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(0, 128, 201, 0.4);
}

.btn-secondary {
    background: #6B7280;
    color: white;
}

.btn-secondary:hover {
    background: #4B5563;
}

.btn-success {
    background: rgba(37, 150, 190, 1);
    color: white;
}

.btn-success:hover {
    background: rgba(37, 150, 190, 0.9);
}

/* Google Auth Button */
.google-auth-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    font-weight: 500;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
}

.google-auth-btn.google-auth-disconnected {
    background: #FCD34D;
    color: #1F2937;
}

.google-auth-btn.google-auth-disconnected:hover {
    background: #FBBF24;
    transform: translateY(-1px);
}

.google-auth-btn.google-auth-connected {
    background: #86EFAC;
    color: #1F2937;
}

.google-auth-btn.google-auth-connected:hover {
    background: #6EE7B7;
    transform: translateY(-1px);
}

.google-auth-icon {
    font-size: 16px;
    line-height: 1;
}

.btn-danger {
    background: #1F2937;
    color: white;
}

.btn-danger:hover {
    background: #111827;
}

.btn-warning {
    background: #ffc107;
    color: #333;
}

.btn-warning:hover {
    background: #e0a800;
}

.btn-small {
    padding: 6px 12px;
    font-size: 13px;
    height: 30px;
    line-height: 1;
}

.button-group {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    align-items: center;
}

/* Prekių eilutės */
.item-row {
    display: grid;
    grid-template-columns: 2fr 80px 100px 100px 40px;
    gap: 10px;
    margin-bottom: 10px;
    align-items: center;
}

.item-row input {
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 6px;
}

.item-total {
    text-align: right;
    font-weight: bold;
    color: #0080C9;
}

@media (max-width: 768px) {
    .item-row {
        grid-template-columns: 1fr;
    }
}

/* Sumos */
.totals {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 6px;
    text-align: right;
    margin: 20px 0;
}

.totals p {
    margin: 5px 0;
    color: #666;
}

.totals .total {
    font-size: 1.3rem;
    font-weight: bold;
    color: #333;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 2px solid #ddd;
}

/* Klientų lentelė */
.clients-table {
    margin: 20px 0;
    overflow-x: auto;
}

.clients-table table {
    width: 100%;
    border-collapse: collapse;
}

.clients-table th,
.clients-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.clients-table th {
    background: #f5f5f5;
    font-weight: 600;
}

.clients-table tr:hover {
    background: #f9f9f9;
}

/* Actions cell - mygtukai vertikaliai, sulygiuoti į dešinę */
.actions-cell {
    text-align: right;
    vertical-align: middle;
    padding: 12px !important;
}

.actions-stack {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
}

.actions-stack .btn,
.actions-stack .btn-placeholder {
    width: 110px;
    height: 30px;
    margin: 0;
}

.btn-placeholder {
    visibility: hidden;
    /* Užima vietą, bet nematomas */
}

/* Importavimo sekcija */
.import-section,
.add-client-section {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 6px;
    margin-bottom: 20px;
}

.import-section h3,
.add-client-section h3 {
    margin-bottom: 10px;
    color: #333;
}

/* Išsaugotos sąskaitos */
.saved-list {
    margin-top: 20px;
}

.invoice-card {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.invoice-card-info h4 {
    color: #333;
    margin-bottom: 5px;
}

.invoice-card-info p {
    color: #666;
    font-size: 14px;
}

.invoice-card-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

hr {
    margin: 30px 0;
    border: none;
    border-top: 2px solid #eee;
}

/* Spausdinimo stiliai */
@media print {
    @page { size: A4; margin: 20mm; }

    /* GRĄŽINAM – jokio kelimo į viršų */
    #printTemplate .invoice-parties,
    #printTemplate .seller-buyer-row,
    #printTemplate .parties-row {
        margin-top: 8mm !important;   /* normalus tarpas */
        padding-top: 0 !important;
    }

    /* Header – sumažinam tarpus */
    #printTemplate .invoice-header {
        margin: 0 !important;
        padding: 0 !important;
    }

    /* Logo dydis ok, bet NUIMAM didelius tarpus po juo */
    #printTemplate #printLogo {
        display: block !important;
        max-height: 70px !important;
        width: auto !important;
        height: auto !important;
        margin: 0 auto 4mm auto !important;
    }

    /* Pavadinimas/serija/data – mažiau oro */
    #printTemplate .invoice-title,
    #printTemplate .invoice-number,
    #printTemplate .invoice-date {
        margin: 1mm 0 !important;
        padding: 0 !important;
        line-height: 1.15 !important;
    }

    /* Jei kažkur yra spacer – nulinam */
    #printTemplate .spacer,
    #printTemplate .header-spacer,
    #printTemplate .top-gap {
        height: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    #printTemplate .date-spacing {
        height: 25px !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    /* Slepiam viską, bet nekeičiame #printTemplate vidinių display */
    body > *:not(#printTemplate) { display: none !important; }

    /* užtikrinam baltą foną */
    html, body, #printTemplate { 
        background: #fff !important; 
        color: #000 !important;
        font-size: 14px !important;
        line-height: 1.35 !important;
    }
    
    /* Vidinis wrapper su padding (paraštės) */
    .invoice-print {
        padding: 5mm !important;
        margin: 0 !important;
        font-size: 14px !important;
        line-height: 1.35 !important;
    }

    /* 1) NUKERTAM visus overlay/backdrop/modal (dažniausiai jie užtamsina) */
    .modal, .modal-backdrop, .backdrop, .overlay, .dialog, .toast, .offcanvas,
    [class*="backdrop"], [class*="overlay"], [class*="modal"] {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
    }

    /* 2) NUIMAM bet kokį filter/opacity/transform, kurie sukuria pilkumą */
    html, body, #printTemplate, #printTemplate * {
        filter: none !important;
        opacity: 1 !important;
        transform: none !important;
        box-shadow: none !important;
        text-shadow: none !important;
    }

    /* 4) Jeigu nori spalvoto logo/spalvų – leisti spausdinti spalvas */
    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    /* Šablonas turi būti normalioje tėkmėje, NE fixed/absolute (kad nebūtų kopijų) */
    #printTemplate {
        position: static !important;
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        overflow: visible !important;
        background: #fff !important;
        color: #000 !important;
    }

    /* LOGO: užtikrinam, kad img NIEKADA nebūtų paslėptas print'e */
    .invoice-header {
        text-align: center !important;
        margin-bottom: 10mm !important;
        width: 100% !important;
    }
    
    #printLogo {
        display: block !important;
        visibility: visible !important;
        width: 120px !important;
        max-width: 120px !important;
        height: auto !important;
        margin: 0 auto 12mm auto !important;
    }
    
    #printTemplate img,
    #printTemplate .logo,
    #printTemplate #logo,
    #printTemplate .invoice-logo,
    #printTemplate .company-logo {
        display: inline-block !important;
        visibility: visible !important;
        max-width: 140px !important;
        height: auto !important;
    }

    /* sumažinam tarpą po antraštės (pavadinimas/serija/data) */
    #printTemplate .invoice-header {
        margin-bottom: 8mm !important;   /* buvo didesnis, dabar mažiau */
        padding-bottom: 0 !important;
    }

    /* Pardavėjas + Pirkėjas vienoje eilutėje (2 stulpeliai) */
    .seller-buyer-row, 
    .parties-row, 
    .invoice-parties, 
    #partiesRow,
    .parties,
    .two-columns {
        display: flex !important;
        justify-content: space-between !important;
        align-items: flex-start !important;
        gap: 20mm !important;
        width: 100% !important;
        margin-top: 10mm !important;
        margin-bottom: 8px !important;
    }

    /* sumažinam tarpą prieš parties bloką (Pardavėjas/Pirkėjas) */
    #printTemplate .invoice-parties,
    #printTemplate .seller-buyer-row,
    #printTemplate .parties-row {
        margin-top: 0 !important;
        padding-top: 0 !important;
    }

    /* jei tarpą daro konkretus "spacer" div – nupjaunam */
    #printTemplate .spacer,
    #printTemplate .header-spacer,
    #printTemplate .top-gap {
        height: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    #printTemplate .date-spacing {
        height: 25px !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    /* Kairė/dešinė kolonos */
    .seller-block, 
    .seller, 
    #seller,
    .buyer-block, 
    .buyer, 
    #buyer,
    .party-seller,
    .party-buyer,
    .party {
        width: 48% !important;
        flex: 1 !important;
        min-width: 0 !important;
    }
    
    /* Paragrafai pardavėjo/pirkėjo blokuose */
    .seller p,
    .buyer p {
        margin: 2px 0 !important;
    }
    
    /* Pardavėjo ir pirkėjo informacijos blokai */
    #printTemplate #printCompanyInfo,
    #printTemplate #printClientInfo {
        display: block !important;
        visibility: visible !important;
        font-size: 14px !important;
        line-height: 1.5 !important;
        word-wrap: break-word !important;
        overflow-wrap: break-word !important;
        white-space: normal !important;
        color: #000 !important;
    }
    
    /* Užtikrinam, kad VISI vaikai matomi */
    #printTemplate #printCompanyInfo,
    #printTemplate #printCompanyInfo *,
    #printTemplate #printClientInfo,
    #printTemplate #printClientInfo * {
        display: block !important;
        visibility: visible !important;
        color: #000 !important;
    }
    
    #printTemplate #printCompanyInfo p,
    #printTemplate #printClientInfo p {
        margin: 2px 0 !important;
        display: block !important;
    }
    
    #printTemplate #printCompanyInfo br,
    #printTemplate #printClientInfo br {
        display: block !important;
        content: "" !important;
        margin: 0 !important;
    }

    /* Panaikinam visus priverstinius puslapio laužymus */
    * {
        break-before: auto !important;
        break-after: auto !important;
        break-inside: auto !important;
        page-break-before: auto !important;
        page-break-after: auto !important;
        page-break-inside: auto !important;
    }

    html, body {
        margin: 0 !important;
        padding: 0 !important;
        height: auto !important;
        overflow: visible !important;
    }
    
    /* VISAS TEKSTAS 14px */
    #printTemplate,
    #printTemplate *,
    .invoice-print,
    .invoice-print * {
        font-size: 14px !important;
        line-height: 1.35 !important;
        color: #000 !important;
    }
    
    /* Pašalinti geltonus fonus */
    .notes-warning,
    .btn-warning,
    .warning-icon {
        background: transparent !important;
        border-color: #ccc !important;
        color: #000 !important;
    }
    
    .invoice-print {
        width: 100%;
        max-width: 100%;
        overflow: visible !important;
        padding: 0 !important;
        margin: 0 !important;
    }
    
    /* Pašalinti visus margin/padding, kurie gali sukurti tuščią puslapį */
    .invoice-main-title,
    .invoice-series,
    .invoice-date-center {
        margin-bottom: 8px !important;
        padding: 0 !important;
    }
    
    .invoice-items,
    .invoice-totals,
    .invoice-words,
    .invoice-signatures,
    .invoice-payment,
    .invoice-notes {
        margin-bottom: 8px !important;
        padding: 0 !important;
    }
    
    /* Paslėpti nereikalingus elementus */
    .no-print {
        display: none !important;
    }
    
    .print-only {
        display: block !important;
    }
    
    .client-notes-display {
        display: none !important;
    }
    
    /* Pašalinti fonus ir šešėlius */
    .total-final,
    .totals-line.total-final,
    .totals-row.total-final {
        background: transparent !important;
        box-shadow: none !important;
    }
    
    .invoice-notes,
    .notes-warning {
        background: transparent !important;
        border-color: #ccc !important;
        padding: 5px !important;
    }
    
    /* Kompaktiška lentelė */
    .invoice-items th,
    .invoice-items td {
        padding: 4px 6px !important;
        font-size: 14px !important;
    }
    
    /* Sumažinti tarpus tarp sekcijų */
    .invoice-parties {
        margin-bottom: 8px !important;
    }
    
    .invoice-totals {
        margin-top: 8px !important;
        margin-bottom: 8px !important;
    }
}

.print-only {
    display: none;
}

/* .print-only stilius perkeltas į pagrindinį @media print bloką */

.invoice-print {
    font-family: Arial, sans-serif;
    color: #000;
    max-width: 800px;
    margin: 0 auto;
    font-size: 14px;
    line-height: 1.35;
}

.invoice-main-title {
    text-align: center;
    font-size: 18px;
    font-weight: bold;
    color: #000;
    margin-bottom: 10px;
    text-decoration: none;
}

.invoice-series {
    text-align: center;
    font-size: 12px;
    margin-bottom: 5px;
    color: #000;
}

.invoice-date-center {
    text-align: center;
    font-size: 12px;
    margin-bottom: 50px;
    color: #000;
}

.invoice-date-row {
    text-align: right;
    margin-bottom: 15px;
}

.date-label {
    font-weight: bold;
    display: block;
}

.date-value {
    display: block;
}

.invoice-parties {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
    gap: 40px;
}

.invoice-parties .party {
    flex: 1;
}

.invoice-parties h3 {
    font-weight: bold;
    margin-bottom: 5px;
    font-size: 11px;
    color: #000;
}

.invoice-parties .seller {
    color: #000;
}

.invoice-parties .buyer {
    color: #000;
}

.party-info {
    line-height: 1.5;
}

.invoice-items {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 10px;
    font-size: 10px;
}

.invoice-items th,
.invoice-items td {
    padding: 5px 8px;
    border: 1px solid #999;
    text-align: center;
}

.invoice-items th {
    background: #f0f0f0;
    font-weight: bold;
}

.invoice-items td:first-child {
    text-align: left;
}

.invoice-items tbody tr:nth-child(odd) {
    background: #fff;
}

.invoice-items tbody tr:nth-child(even) {
    background: #fafafa;
}

.invoice-totals {
    width: 250px;
    margin-left: auto;
    margin-bottom: 20px;
    font-size: 11px;
}

.totals-row {
    display: flex;
    justify-content: space-between;
    padding: 3px 0;
    border-bottom: 1px solid #ddd;
}

.totals-row span:first-child {
    flex: 2;
    text-align: left;
}

.totals-row span:nth-child(2) {
    width: 20px;
    text-align: center;
}

.totals-row span:last-child {
    width: 60px;
    text-align: right;
}

.total-final {
    font-weight: bold;
    background: transparent;
}

.invoice-words {
    margin: 20px 0;
    font-size: 11px;
}

.invoice-words p:first-child {
    font-weight: bold;
}

.invoice-signatures {
    margin: 30px 0;
    font-size: 11px;
}

.invoice-signatures p {
    margin: 15px 0;
}

.invoice-payment {
    margin-top: 30px;
    font-weight: bold;
    font-size: 14px;
    background: transparent !important;
}

.invoice-notes {
    background: transparent;
    padding: 10px;
    margin-top: 15px;
    border-left: 3px solid #ccc;
    font-size: 10px;
}

/* Pranešimai */
.alert {
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* ==================== INVOICE EDITOR STILIAI ==================== */

.invoice-editor {
    background: white;
    padding: 30px;
    max-width: 800px;
    margin: 0 auto;
    font-family: Arial, sans-serif;
    font-size: 12px;
}

.invoice-editor .invoice-main-title {
    text-align: center;
    font-size: 20px;
    font-weight: bold;
    color: #000;
    text-decoration: none;
    margin-bottom: 20px;
}

.invoice-series-row {
    text-align: center;
    margin-bottom: 25px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
}

.invoice-series-row label {
    font-weight: normal;
}

.series-input {
    width: 70px;
    text-align: center;
    border: 1px solid #ccc;
    padding: 5px;
    border-radius: 4px;
}

select.series-input {
    width: auto;
    min-width: 70px;
    cursor: pointer;
}

.number-input {
    width: 100px;
    text-align: center;
    border: 1px solid #ccc;
    padding: 5px;
    border-radius: 4px;
}

#addSeriesBtn {
    padding: 5px 10px;
    font-size: 14px;
}

.invoice-date-section {
    text-align: center;
    margin-bottom: 100px;
}

.invoice-date-section .date-label {
    font-weight: bold;
    display: block;
    margin-bottom: 5px;
}

.date-input {
    border: 1px solid #ccc;
    padding: 5px;
    width: 140px;
}

.invoice-parties-editor {
    display: flex;
    justify-content: space-between;
    margin-bottom: 25px;
    gap: 30px;
}

.party-editor {
    flex: 1;
}

.party-editor h3 {
    font-weight: bold;
    margin-bottom: 10px;
    font-size: 12px;
}

.party-editor.seller h3 {
    color: #000;
}

.party-editor.buyer h3 {
    color: #000;
}

.party-display {
    line-height: 1.6;
    min-height: 100px;
}

.party-display p {
    margin: 2px 0;
}

.party-editor.seller .party-display {
    color: #000;
}

.party-editor.buyer .party-display {
    color: #000;
}

.client-select {
    width: 100%;
    padding: 8px;
    margin-bottom: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

.client-search-container {
    position: relative;
    margin-bottom: 10px;
}

.client-search {
    width: 100%;
    padding: 10px;
    border: 2px solid #ccc;
    border-radius: 6px;
    font-size: 14px;
    box-sizing: border-box;
}

.client-search:focus {
    border-color: #0080C9;
    outline: none;
}

.client-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ccc;
    border-top: none;
    border-radius: 0 0 6px 6px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.client-suggestions.show {
    display: block;
}

.client-suggestion-item {
    padding: 10px 12px;
    cursor: pointer;
    border-bottom: 1px solid #eee;
    color: #1a1a1a;
}

.client-suggestion-item:last-child {
    border-bottom: none;
}

.client-suggestion-item:hover,
.client-suggestion-item.selected {
    background: #0080C9;
    color: white;
}

.client-suggestion-item .client-code {
    font-size: 11px;
    color: #333;
}

.client-suggestion-item:hover .client-code,
.client-suggestion-item.selected .client-code {
    color: #ddd;
}

.no-results {
    padding: 10px 12px;
    color: #888;
    font-style: italic;
}

/* Invoice Table Editor */
.invoice-table-editor {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 10px;
    font-size: 11px;
}

.invoice-table-editor th,
.invoice-table-editor td {
    border: 1px solid #999;
    padding: 6px;
    text-align: center;
}

.invoice-table-editor th {
    background: #f5f5f5;
    font-weight: bold;
    font-size: 10px;
}

.invoice-table-editor th:first-child,
.invoice-table-editor td:first-child {
    text-align: left;
    width: 35%;
}

.invoice-table-editor input {
    width: 100%;
    border: none;
    text-align: center;
    padding: 4px;
    background: transparent;
}

.invoice-table-editor select.item-unit {
    width: 100%;
    border: none;
    text-align: center;
    padding: 4px;
    background: transparent;
    cursor: pointer;
    font-size: 14px;
}

.invoice-table-editor select.item-unit:focus {
    outline: 2px solid #0080C9;
    background: #f0f0ff;
}

.invoice-table-editor th .unit-type-select {
    width: 70px;
    border: 1px solid #ddd;
    text-align: center;
    padding: 4px;
    background: white;
    cursor: pointer;
    font-size: 14px;
    border-radius: 3px;
}

.invoice-table-editor th .unit-type-select:focus {
    outline: 2px solid #0080C9;
    border-color: #0080C9;
}

.invoice-table-editor td:first-child input {
    text-align: left;
}

.invoice-table-editor input:focus {
    outline: 2px solid #0080C9;
    background: #f0f0ff;
}

.delete-cell {
    border: none !important;
    background: transparent !important;
    padding: 0 0 0 10px !important;
    vertical-align: middle;
}

.btn-remove-row {
    background: transparent;
    color: #000;
    border: none;
    width: 25px;
    height: 25px;
    cursor: pointer;
    font-size: 20px;
    font-weight: bold;
    line-height: 1;
    padding: 0;
    transition: opacity 0.2s;
}

.btn-remove-row:hover {
    opacity: 0.6;
}

/* Totals Editor */
.invoice-totals-editor {
    width: 280px;
    margin-left: auto;
    margin-bottom: 20px;
    font-size: 12px;
}

.totals-line {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    border-bottom: 1px solid #ddd;
}

.totals-line span:first-child {
    flex: 2;
    text-align: left;
}

.totals-line span:nth-child(2) {
    width: 25px;
    text-align: center;
}

.totals-line span:last-child {
    width: 70px;
    text-align: right;
    font-weight: bold;
}

.totals-line.total-final {
    background: transparent;
    font-weight: bold;
    border: 1px solid #ccc;
    padding: 6px 4px;
}

/* Words, Signatures, Due */
.invoice-words-editor {
    margin: 20px 0;
}

.invoice-words-editor p:first-child {
    font-weight: bold;
}

.invoice-signatures-editor {
    margin: 25px 0;
}

.invoice-signatures-editor p {
    margin: 20px 0;
    border-bottom: 1px solid #000;
    padding-bottom: 20px;
    width: 250px;
}

.invoice-due-editor {
    margin: 20px 0;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 10px;
}

.invoice-notes-editor {
    margin: 20px 0;
}

.invoice-notes-editor label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

.invoice-notes-editor textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

/* Autocomplete stiliai */
.client-search-container {
    position: relative;
    width: 100%;
}

.client-search-container input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
    color: #000 !important;
}

.client-search-container input::placeholder {
    color: #999;
}

.client-search-container input:-webkit-autofill,
.client-search-container input:-webkit-autofill:hover,
.client-search-container input:-webkit-autofill:focus {
    -webkit-text-fill-color: #000 !important;
    -webkit-box-shadow: 0 0 0px 1000px white inset !important;
    color: #000 !important;
}

.client-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ccc;
    border-top: none;
    border-radius: 0 0 4px 4px;
    max-height: 250px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.client-suggestion-item {
    padding: 10px 15px;
    cursor: pointer;
    border-bottom: 1px solid #eee;
    transition: background 0.2s;
}

.client-suggestion-item:last-child {
    border-bottom: none;
}

.client-suggestion-item:hover,
.client-suggestion-item.selected {
    background: #f0f7ff;
}

.client-suggestion-item .client-name {
    font-weight: bold;
    color: #1a1a1a;
}

.client-suggestion-item .client-code {
    font-size: 12px;
    color: #333;
    margin-top: 2px;
}

/* Kliento pastabų stiliai - tik ekrane, ne spausdinant */
.client-notes-display {
    margin-top: 10px;
}

.notes-warning {
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-left: 4px solid #ffc107;
    border-radius: 4px;
    padding: 10px 15px;
    color: #856404;
    display: none !important; /* Paslėpta visur - pastabos tik vidiniams tikslams */
}

.notes-warning strong {
    display: block;
    margin-bottom: 5px;
}

.notes-warning p {
    margin: 0;
    white-space: pre-wrap;
}

/* .client-notes-display stilius perkeltas į pagrindinį @media print bloką */

/* Klientų filtravimo stiliai */
.client-filter-container {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
}

.client-filter-input {
    flex: 1;
    padding: 12px 15px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 15px;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.client-filter-input:focus {
    outline: none;
    border-color: #0080C9;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

.client-filter-count {
    color: #666;
    font-size: 14px;
    white-space: nowrap;
}

/* Input su mygtuku */
.input-with-button {
    display: flex;
    gap: 5px;
    align-items: stretch;
}

.input-with-button input {
    flex: 1;
}

.btn-info {
    background: #17a2b8;
    color: white;
    padding: 8px 12px;
    font-size: 14px;
}

.btn-info:hover {
    background: #138496;
}

/* Įspėjimo ikona */
.warning-icon {
    cursor: help;
    margin-right: 5px;
    font-size: 16px;
}

.btn-warning {
    background: #ffc107;
    color: #212529;
}

.btn-warning:hover {
    background: #e0a800;
}

/* Buhalterės pastabos */
.invoice-notes {
    margin-top: 8px;
    padding: 8px 12px;
    background-color: transparent;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
    color: #333;
}

.invoice-notes strong {
    color: #6b5d1a;
}

/* Mėnesio sąskaitų kontrolės */
.month-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.month-controls label {
    font-weight: 500;
    color: #333;
}

.month-controls select {
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: white;
}

.search-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.search-controls input[type="text"] {
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: white;
}
/* ============ AI AGENT MODAL ============ */
.ai-modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    align-items: center;
    justify-content: center;
}

.ai-modal-content {
    background: white;
    width: 90%;
    max-width: 1200px;
    max-height: 90vh;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
}

.ai-modal-header {
    background: linear-gradient(135deg, #0080C9 0%, #6B7280 100%);
    color: white;
    padding: 20px 30px;
    border-radius: 12px 12px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ai-modal-header h2 {
    margin: 0;
    font-size: 24px;
}

.ai-modal-close {
    background: none;
    border: none;
    color: white;
    font-size: 32px;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 40px;
    height: 40px;
}

.ai-modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
}

.ai-modal-body {
    padding: 30px;
    overflow-y: auto;
    flex: 1;
}

.ai-search-section,
.ai-quick-actions,
.ai-command-section,
.ai-results-section {
    margin-bottom: 25px;
}

.ai-modal-body h3 {
    font-size: 18px;
    margin-bottom: 12px;
    color: #0080C9;
}

.ai-input-group {
    display: flex;
    gap: 10px;
}

.ai-input-group input {
    flex: 1;
    width: 100%;
    min-width: 400px;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 15px;
}

.ai-input-group input:focus {
    outline: none;
    border-color: #0080C9;
}

.ai-btn-group {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
}

#ai-command-input {
    width: 100%;
    min-height: 100px;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 15px;
    font-family: inherit;
    resize: vertical;
    margin-bottom: 10px;
}

#ai-command-input:focus {
    outline: none;
    border-color: #0080C9;
}

#ai-search-results,
#ai-results {
    margin-top: 15px;
}

.ai-client-item {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.3s;
}

.ai-client-item:hover {
    border-color: #0080C9;
    background: #f8f9fa;
}

.ai-result-card {
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 10px;
}

.ai-result-card h4 {
    font-size: 16px;
    color: #0080C9;
    margin-bottom: 10px;
}

.ai-invoice-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
    background: white;
}

.ai-invoice-table th,
.ai-invoice-table td {
    padding: 10px;
    text-align: left;
    border: 1px solid #e0e0e0;
    font-size: 13px;
}

.ai-invoice-table th {
    background: #0080C9;
    color: white;
    font-weight: 500;
}

.ai-invoice-table tr:hover {
    background: #f8f9fa;
}

.ai-loading {
    text-align: center;
    padding: 20px;
    color: #0080C9;
    font-size: 16px;
}

.ai-error {
    background: #fee;
    border: 1px solid #fcc;
    color: #c33;
    padding: 12px;
    border-radius: 8px;
    margin-top: 10px;
}

.ai-success {
    background: #efe;
    border: 1px solid #cfc;
    color: #3c3;
    padding: 12px;
    border-radius: 8px;
    margin-top: 10px;
}

@media (max-width: 768px) {
    .ai-modal-content {
        width: 95%;
        max-height: 95vh;
    }
    
    .ai-modal-header {
        padding: 15px 20px;
    }
    
    .ai-modal-body {
        padding: 20px;
    }
    
    .ai-btn-group {
        grid-template-columns: 1fr;
    }
    
    .ai-invoice-table {
        font-size: 11px;
    }
    
    .ai-invoice-table th,
    .ai-invoice-table td {
        padding: 6px;
    }
}

/* AI Assistant New Modal Styles */
.ai-mode-selection {
    text-align: center;
    padding: 20px 0;
}

.ai-mode-selection h3 {
    margin-bottom: 20px;
    color: #333;
    font-size: 18px;
}

.ai-main-buttons {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin-bottom: 20px;
}

.ai-main-button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    min-width: 120px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.ai-main-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 10px rgba(0, 0, 0, 0.15);
}

.ai-back-button {
    background: #6c757d;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    margin-bottom: 15px;
}

.ai-back-button:hover {
    background: #5a6268;
}

.ai-mode-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.ai-mode-content.active {
    display: block;
}

.ai-search-container {
    margin-bottom: 20px;
}

.ai-search-input {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    margin-bottom: 10px;
    box-sizing: border-box;
    color: #000; /* Ensure black text */
    background-color: #fff; /* Ensure white background */
}

.ai-search-input::placeholder {
    color: #666; /* Dark gray placeholders */
}

.ai-search-button {
    background: #28a745;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.ai-search-button:hover {
    background: #218838;
}

.ai-results-container {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid #ddd;
    border-radius: 6px;
}

.ai-invoice-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0;
    table-layout: fixed;
}

.ai-invoice-table th,
.ai-invoice-table td {
    overflow: hidden;
    text-overflow: ellipsis;
}

.ai-invoice-table th {
    background-color: #f8f9fa;
    font-weight: bold;
    text-align: left;
    border-bottom: 2px solid #dee2e6;
    padding: 10px 8px;
}

.ai-invoice-table td {
    padding: 8px;
    border-bottom: 1px solid #dee2e6;
    color: #000; /* Ensure black text in table cells */
}

.ai-invoice-table tr:hover {
    background-color: #f5f5f5;
}

.ai-action-button {
    background: #007bff;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 12px;
    margin: 2px;
}

.ai-action-button:hover {
    background: #0056b3;
}

.ai-action-button.danger {
    background: #dc3545;
}

.ai-action-button.danger:hover {
    background: #c82333;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
    .ai-main-buttons {
        flex-direction: column;
        align-items: center;
    }
    
    .ai-main-button {
        width: 100%;
        max-width: 200px;
    }
    
    .ai-invoice-table {
        font-size: 12px;
    }
    
    .ai-invoice-table th,
    .ai-invoice-table td {
        padding: 6px 4px;
    }
}

/* Additional AI Assistant Styles */
.ai-empty-message {
    text-align: center;
    color: #6c757d;
    font-style: italic;
    padding: 20px !important;
}

.ai-input-group {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.ai-input-group input {
    flex: 1;
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    color: #000; /* Ensure black text in inputs */
}

.ai-input-group input::placeholder {
    color: #666; /* Dark gray for placeholders */
}

.ai-input-group button {
    padding: 10px 20px;
    white-space: nowrap;
}

.ai-search-section {
    margin-bottom: 20px;
}

.ai-results-section {
    margin-top: 15px;
}

.ai-mode-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
}

.ai-mode-header h3 {
    margin: 0;
    flex: 1;
    color: #000; /* Ensure black text for headings */
}

.ai-back-btn {
    background: #6c757d;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

/* AI Modal Text Color Overrides for Readability */
#aiAgentModal {
    color: #000; /* Ensure all text in AI modal is black by default */
}

#aiAgentModal .ai-modal-content {
    color: #000;
}

#aiAgentModal .ai-modal-body {
    color: #000;
}

#aiAgentModal .ai-mode-selection h3 {
    color: #333;
}

#aiAgentModal .ai-invoice-table {
    color: #000;
}

#aiAgentModal .ai-invoice-table th {
    color: white; /* Keep table headers white on colored background */
}

#aiAgentModal .ai-invoice-table td {
    color: #000; /* Ensure table cells have black text */
}

#aiAgentModal .ai-search-input {
    color: #000; /* Ensure search inputs have black text */
}

#aiAgentModal .ai-search-input::placeholder {
    color: #666; /* Dark gray placeholders */
}

#aiAgentModal input[type="text"] {
    color: #000; /* Ensure all text inputs have black text */
}

#aiAgentModal input[type="text"]::placeholder {
    color: #666; /* Dark gray placeholders */
}

#aiAgentModal p, 
#aiAgentModal span, 
#aiAgentModal div {
    color: inherit; /* Inherit the black color from parent */
}
/* === AI AGENT – FORCE TEXT COLOR FIX === */
#aiAgentModal,
#aiAgentModal table,
#aiAgentModal th,
#aiAgentModal td,
#aiAgentModal input,
#aiAgentModal textarea,
#aiAgentModal select,
#aiAgentModal ::placeholder {
  color: #000 !important;
}

#aiAgentModal th {
  font-weight: 600;
}

#aiAgentModal table {
  background-color: #fff;
}

/* === AI ASSISTANT ACTION BUTTONS === */
.ai-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.btn-ai-print {
    background: #6c757d;
    color: white;
    border: none;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-ai-print:hover {
    background: #5a6268;
}

.btn-ai-send {
    background: #28a745;
    color: white;
    border: none;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-ai-send:hover {
    background: #218838;
}

.btn-ai-edit {
    background: #007bff;
    color: white;
    border: none;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-ai-edit:hover {
    background: #0056b3;
}

.btn-ai-view {
    background: #007bff;
    color: white;
    border: none;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-ai-view:hover {
    background: #0056b3;
}

.ai-no-file {
    color: #dc3545;
    font-size: 12px;
    font-style: italic;
}

/* === AI AGENT – FINAL TEXT COLOR OVERRIDE === */
#aiAgentModal * {
  color: #000 !important;
}

#aiAgentModal th,
#aiAgentModal td {
  color: #000 !important;
  background-color: #fff !important;
}

/* Šie stiliai perkelta į pagrindinį @media print bloką aukščiau */

/* === PDF EXPORT STYLING (for html2canvas generation) === */
/* Apply the same styles as print when generating PDF via html2canvas */
#printTemplate.pdf-export-active {
    display: block !important;
    visibility: visible !important;
    position: absolute;
    left: -9999px; /* Keep off-screen but rendered */
    top: 0;
    width: 210mm !important;
    max-width: 210mm !important;
    background: white;
    padding: 0;
    margin: 0;
    box-sizing: border-box;
    overflow: visible !important;
}

#printTemplate.pdf-export-active * {
    visibility: visible !important;
}

#printTemplate.pdf-export-active .invoice-print {
    font-size: 14px;
    width: 100%;
    max-width: 100%;
    overflow: visible !important;
}

#printTemplate.pdf-export-active .invoice-main-title {
    font-size: 20px;
}

#printTemplate.pdf-export-active .invoice-series {
    font-size: 14px;
}

#printTemplate.pdf-export-active .invoice-date-center {
    font-size: 14px;
}

#printTemplate.pdf-export-active .invoice-parties h3 {
    font-size: 14px;
}

#printTemplate.pdf-export-active .invoice-items th {
    font-size: 13px;
    padding: 6px 8px;
}

#printTemplate.pdf-export-active .invoice-items td {
    font-size: 13px;
    padding: 6px 8px;
}

#printTemplate.pdf-export-active .invoice-totals {
    font-size: 14px;
}

#printTemplate.pdf-export-active .invoice-words {
    font-size: 14px;
}

#printTemplate.pdf-export-active .invoice-signatures {
    font-size: 14px;
}

#printTemplate.pdf-export-active .invoice-payment {
    font-size: 14px;
    background: transparent !important;
}

#printTemplate.pdf-export-active .invoice-notes {
    font-size: 14px;
    background: transparent !important;
    border-color: #ccc !important;
}

/* ==================== SKOLOS MODE STYLES ==================== */

/* Combined email button for Skolos mode */
.ai-combined-email {
    margin-bottom: 15px;
    text-align: center;
}

.ai-combined-btn {
    background: #f39c12 !important;
    color: white !important;
    border: none !important;
    padding: 12px 20px !important;
    font-size: 14px !important;
    font-weight: bold !important;
    border-radius: 8px !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
}

.ai-combined-btn:hover {
    background: #e67e22 !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15) !important;
}

.ai-combined-btn:active {
    transform: translateY(0) !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
}

/* Debt amount highlighting */
.debt-amount {
    font-weight: bold !important;
    color: #e74c3c !important;
    background: rgba(231, 76, 60, 0.1) !important;
    padding: 4px 8px !important;
    border-radius: 4px !important;
}

/* Debt summary section */
.debt-summary {
    background: #f8f9fa;
    border-left: 4px solid #e74c3c;
    padding: 15px 20px;
    margin: 15px 0;
    border-radius: 4px;
}

.debt-summary p {
    margin: 8px 0;
    font-size: 15px;
}

.debt-total {
    color: #e74c3c;
    font-weight: bold;
    font-size: 18px;
}

/* AI loading state for Skolos */
.ai-loading {
    text-align: center;
    padding: 40px;
    font-size: 16px;
    color: #666;
    font-style: italic;
}

/* AI error state for Skolos */
.ai-error {
    text-align: center;
    padding: 20px;
    font-size: 14px;
    color: #e74c3c;
    background: rgba(231, 76, 60, 0.1);
    border-radius: 8px;
    border: 1px solid #e74c3c;
}

/* Empty message styling for Skolos */
.ai-empty-message {
    text-align: center !important;
    color: #666 !important;
    font-style: italic !important;
    padding: 20px !important;
}

/* Skolos search input styling */
#skolos-search-input {
    border: 2px solid #f39c12 !important;
}

#skolos-search-input:focus {
    border-color: #e67e22 !important;
    box-shadow: 0 0 0 3px rgba(243, 156, 18, 0.2) !important;
}

/* Skolos search button specific styling */
.btn-warning.ai-mode-btn {
    background: #f39c12 !important;
    border-color: #f39c12 !important;
}

.btn-warning.ai-mode-btn:hover {
    background: #e67e22 !important;
    border-color: #e67e22 !important;
}

/* Button styling for Skolos actions */
.btn-ai-send, .btn-ai-print {
    padding: 6px 12px !important;
    margin: 2px !important;
    font-size: 12px !important;
    border-radius: 4px !important;
    border: none !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
}

.btn-ai-print {
    background: #3498db !important;
    color: white !important;
}

.btn-ai-print:hover {
    background: #2980b9 !important;
}

.btn-ai-send {
    background: #2ecc71 !important;
    color: white !important;
}

.btn-ai-send:hover {
    background: #27ae60 !important;
}

.ai-actions {
    display: flex !important;
    gap: 5px !important;
    justify-content: center !important;
    flex-wrap: wrap !important;
}

/* ============ AI SUGGESTION MODAL ============ */
.modal-overlay {
    display: none;
    position: fixed;
    z-index: 10001;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    align-items: center;
    justify-content: center;
}

.modal-overlay .modal-content {
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    color: #000;
}

.modal-overlay .btn-close {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: #666;
    padding: 0;
    width: 32px;
    height: 32px;
    line-height: 28px;
    text-align: center;
}

.modal-overlay .btn-close:hover {
    color: #000;
}

/* New Client Button */
.client-search-container {
    position: relative;
    display: flex;
    gap: 8px;
    align-items: center;
}

.btn-new-client {
    background: #28a745;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    white-space: nowrap;
    transition: background-color 0.2s;
}

.btn-new-client:hover {
    background: #218838;
}

/* New Client Modal */
#newClientModal .modal-content {
    width: 500px;
    max-width: 90vw;
}

#newClientModal .form-group {
    margin-bottom: 16px;
}

#newClientModal .form-group label {
    display: block;
    margin-bottom: 4px;
    font-weight: 500;
}

#newClientModal .required {
    color: #dc3545;
}

#newClientModal input,
#newClientModal textarea {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

#newClientModal textarea {
    resize: vertical;
    min-height: 60px;
}

#newClientModal .form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 20px;
}

/* AI Search Results */
.ai-result-card {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 12px;
}

.ai-result-card h5 {
    margin: 0 0 8px 0;
    color: #333;
    font-size: 16px;
    font-weight: 600;
}

.ai-result-card p {
    margin: 4px 0;
    font-size: 14px;
    color: #666;
}

.ai-empty-message {
    text-align: center;
    padding: 20px;
    color: #666;
    font-style: italic;
}

/* AI Assistant Modal */
.ai-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    padding: 20px;
}

.ai-modal-content {
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    max-width: 900px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}

.ai-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #eee;
    background: linear-gradient(135deg, #0080C9 0%, #6B7280 100%);
    color: white;
    border-radius: 12px 12px 0 0;
}

.ai-modal-header h2 {
    margin: 0;
    font-size: 1.5em;
}

.ai-close {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: white;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s;
}

.ai-close:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.ai-mode-selection {
    padding: 30px;
    text-align: center;
}

.ai-mode-selection h3 {
    margin-bottom: 20px;
    color: #333;
}

.ai-mode-buttons {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
}

.ai-mode-btn {
    background: linear-gradient(135deg, #0080C9 0%, #6B7280 100%);
    color: white;
    border: none;
    padding: 20px 30px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    transition: transform 0.2s, box-shadow 0.2s;
    min-width: 200px;
}

.ai-mode-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 128, 201, 0.3);
}

.ai-mode-content {
    padding: 20px;
}

.ai-mode-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}

.ai-back-btn {
    background: #6B7280;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
}

.ai-back-btn:hover {
    background: #5A6C7D;
}

.ai-search-section {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    align-items: stretch;
}

.ai-search-input {
    flex: 1;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
}

.ai-search-input:focus {
    outline: none;
    border-color: #0080C9;
}

.ai-search-btn {
    background: #0080C9;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    white-space: nowrap;
}

.ai-search-btn:hover {
    background: #006BA1;
}

.ai-results {
    min-height: 100px;
    max-height: 400px;
    overflow-y: auto;
}

.ai-results-container {
    background: #f9f9f9;
    border-radius: 5px;
    padding: 15px;
}

.ai-invoice-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
    background: white;
    border-radius: 5px;
    overflow: hidden;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.ai-invoice-table th {
    background: #0080C9;
    color: white;
    padding: 12px;
    text-align: left;
    font-weight: 500;
}

.ai-invoice-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #eee;
}

/* Pulse animation for Google auth button */
@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 4px 15px rgba(37, 150, 190, 0.5);
    }
}

.ai-invoice-table tr:hover {
    background: #f5f5f5;
}

.ai-loading {
    text-align: center;
    padding: 20px;
    color: #666;
    font-style: italic;
}

.ai-error {
    background: #fee;
    color: #c33;
    padding: 15px;
    border-radius: 5px;
    border-left: 4px solid #c33;
}

/* AI Assistant Button - Ensure it's always clickable */
#openAiAgentBtn,
.ai-assistant-btn,
[data-ai-assistant="open"] {
    position: relative !important;
    z-index: 1000 !important;
    pointer-events: auto !important;
    cursor: pointer !important;
}

#openAiAgentBtn:hover,
.ai-assistant-btn:hover,
[data-ai-assistant="open"]:hover {
    transform: none !important;
    opacity: 0.9;
}
