* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, sans-serif;
    background: #f3f4f6;
    color: #111827;
}

.container {
    max-width: 600px;
    margin: 30px auto;
    padding: 16px;
}

.card {
    background: #fff;
    padding: 24px;
    border-radius: 14px;
    box-shadow: 0 8px 30px rgba(0,0,0,.08);
    margin-bottom: 18px;
}

h1 {
    margin: 0 0 6px;
    font-size: 23px;
}

.subtitle {
    margin: 0 0 22px;
    color: #6b7280;
    font-size: 14px;
}


/* ---------------------------------------------------------
   FORM
--------------------------------------------------------- */

.grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

label {
    display: block;
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 6px;
}

input,
select,
textarea {
    width: 100%;
    padding: 11px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 15px;
    outline: none;
    background: white;
    font-family: inherit;
}

input:focus,
select:focus,
textarea:focus {
    border-color: #111827;
}

input.invalid,
select.invalid {
    border-color: #dc2626;
    background: #fef2f2;
}

textarea {
    min-height: 150px;
    resize: vertical;
    line-height: 1.5;
}

.error {
    display: block;
    color: #dc2626;
    font-size: 12px;
    min-height: 15px;
    margin-top: 4px;
}

.hint {
    color: #6b7280;
    font-size: 13px;
    line-height: 1.5;
    margin: 8px 0 14px;
}


/* ---------------------------------------------------------
   BUTTONS
--------------------------------------------------------- */

button,
a.whatsapp {
    width: 100%;
    display: block;
    border: 0;
    border-radius: 8px;
    padding: 13px;
    margin-top: 10px;
    font-size: 15px;
    font-weight: 700;
    text-align: center;
    cursor: pointer;
    text-decoration: none;
    font-family: inherit;
}

.generate {
    background: #111827;
    color: white;
}

.whatsapp {
    background: #25d366;
    color: white;
    font-size: 16px;
}

.copy {
    background: #e5e7eb;
    color: #111827;
}

.danger {
    background: #fee2e2;
    color: #b91c1c;
}

.link-btn {
    background: none;
    border: 0;
    padding: 0;
    margin: 0;
    width: auto;
    display: inline;
    color: #2563eb;
    font-size: 12px;
    cursor: pointer;
    text-decoration: underline;
}

.actions-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}


/* ---------------------------------------------------------
   RESULT
--------------------------------------------------------- */

.result {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid #e5e7eb;
}

.result-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}

.status {
    text-align: center;
    font-size: 12px;
    color: #6b7280;
    margin-top: 10px;
    min-height: 15px;
}

.warning {
    background: #fef3c7;
    border: 1px solid #f59e0b;
    color: #92400e;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 13px;
    line-height: 1.5;
    margin-top: 10px;
}

.hidden {
    display: none;
}


/* ---------------------------------------------------------
   SETTINGS / HISTORY (details elements)
--------------------------------------------------------- */

details summary {
    cursor: pointer;
    font-weight: 700;
    font-size: 15px;
    user-select: none;
}

details[open] summary {
    margin-bottom: 14px;
}

.count-badge {
    background: #25d366;
    color: white;
    border-radius: 999px;
    font-size: 11px;
    padding: 2px 8px;
    margin-left: 6px;
    vertical-align: middle;
}


/* ---------------------------------------------------------
   LEAD HISTORY LIST
--------------------------------------------------------- */

.history-list {
    list-style: none;
    margin: 0 0 8px;
    padding: 0;
    max-height: 320px;
    overflow-y: auto;
}

.lead-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 4px;
    border-bottom: 1px solid #f3f4f6;
}

.lead-item:last-child {
    border-bottom: 0;
}

.lead-info {
    flex: 1;
    min-width: 0;
}

.lead-name {
    font-weight: 700;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.lead-meta {
    color: #6b7280;
    font-size: 12px;
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.badge {
    flex-shrink: 0;
    font-size: 11px;
    font-weight: 700;
    border-radius: 999px;
    padding: 3px 9px;
}

.badge.sent {
    background: #dcfce7;
    color: #166534;
}

.badge.copied {
    background: #dbeafe;
    color: #1e40af;
}

.badge.maps {
    background: #ede9fe;
    color: #5b21b6;
    margin-right: -4px;
}

.lead-delete {
    flex-shrink: 0;
    background: none;
    border: 0;
    cursor: pointer;
    font-size: 15px;
    color: #9ca3af;
    padding: 4px;
    margin: 0;
    width: auto;
}

.lead-delete:hover {
    color: #dc2626;
}

.empty-note {
    color: #6b7280;
    font-size: 13px;
    text-align: center;
    padding: 14px 0;
}


.footer-note {
    text-align: center;
    color: #9ca3af;
    font-size: 12px;
}


@media(max-width: 600px) {

    .container {
        margin: 10px auto;
    }

    .card {
        padding: 18px;
    }

    .grid {
        grid-template-columns: 1fr;
    }
}
