﻿.wa-page {
    --wa-ink: #0f172a;
    --wa-muted: #475569;
    --wa-border: #e2e8f0;
    --wa-green: #08745c;
    display: grid;
    gap: 1rem;
    max-width: 96rem;
    margin: auto;
    padding: clamp(.875rem, 2.5vw, 2rem);
    color: var(--wa-ink);
}

.wa-hero {
    display: flex;
    align-items: center;
    gap: clamp(.75rem, 2vw, 1.5rem);
    padding: clamp(1rem, 4vw, 2.75rem);
    border-radius: 1.375rem;
    background: radial-gradient(ellipse at 90% 0%, #237e67 0%, transparent 58%), linear-gradient(120deg, #102c27, #075b48);
    color: white;
    box-shadow: 0 14px 30px -22px #143e35;
}

.wa-hero-icon {
    display: grid;
    flex: none;
    place-items: center;
    width: clamp(2.5rem, 6vw, 4rem);
    aspect-ratio: 1;
    border: 1px solid #71e39a;
    border-radius: .875rem;
    background: linear-gradient(145deg, #31d66b, #1eae54);
    color: #fff;
    box-shadow: 0 8px 20px -10px #031d14;
}

.wa-hero-icon .fa-whatsapp { font-size: clamp(1.5rem, 4vw, 2.375rem); line-height: 1; }
.wa-nav-icon { width: 1.5rem; flex: none; color: inherit; font-size: 1.5rem; text-align: center; }
#main-content .wa-hero h1 { display: block; margin: 0; color: #fff; font-size: clamp(1.35rem, 3vw, 2.25rem); font-weight: 800; line-height: 1.15; }
.wa-hero p { margin-top: .5rem; font-size: .875rem; color: #daf4eb; }

.wa-panel {
    min-width: 0;
    padding: clamp(1rem, 2vw, 1.5rem);
    border: 1px solid var(--wa-border);
    border-radius: .875rem;
    background: white;
    box-shadow: 0 4px 18px -16px #0f172a;
}

.wa-heading { color: var(--wa-ink); font-size: 1.125rem; font-weight: 800; }
.wa-filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr)); gap: .875rem; }
.wa-config:empty { display: none; }
.wa-page label { color: var(--wa-ink); font-weight: 600; }

.wa-field {
    display: block;
    width: 100%;
    min-width: 0;
    min-height: 2.875rem;
    margin-top: .375rem;
    padding: .625rem .875rem;
    border: 1px solid #d3dedb;
    border-radius: .625rem;
    background-color: #f8fafc;
    color: #172b35;
    font: inherit;
    font-size: .875rem;
    transition: border-color .15s, background-color .15s, box-shadow .15s;
}

select.wa-field {
    appearance: none;
    padding-inline-end: 2.5rem;
    background-image: linear-gradient(45deg, transparent 50%, #08745c 50%), linear-gradient(135deg, #08745c 50%, transparent 50%);
    background-position: right 1.125rem center, right .8125rem center;
    background-size: 5px 5px;
    background-repeat: no-repeat;
    cursor: pointer;
}

.wa-field::placeholder { color: #5d726b; font-weight: 400; opacity: 1; }
.wa-field-hint { color: var(--wa-muted); font-size: .75rem; overflow-wrap: anywhere; }
select.wa-field:has(option[value=""]:checked) { color: #5d726b; }
.wa-field:hover { border-color: #78ac99; background-color: #fff; }
.wa-field:focus-visible,
.wa-button:focus-visible,
.wa-table-wrap:focus-visible { outline: 2px solid #08745c; outline-offset: 3px; }
.wa-page input[type="checkbox"], .wa-reminder-recipient input { accent-color: #08745c; }

.wa-button {
    min-height: 2.75rem;
    padding: .625rem 1rem;
    border: 1px solid #08745c;
    border-radius: .625rem;
    background: #08745c;
    color: white;
    font-size: .875rem;
    font-weight: 750;
    cursor: pointer;
    transition: background-color .15s, border-color .15s;
}

.wa-button:hover { background: #055744; border-color: #055744; }
.wa-button-secondary { border-color: #cceadd; background: #f3faf6; color: #076046; }
.wa-button-secondary:hover { border-color: #a9d6c3; background: #e4f5ed; }
.wa-button:disabled { opacity: .58; cursor: wait; }

.wa-metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .625rem; }
.wa-metrics:empty { display: none; }
.wa-metric { display: flex; align-items: center; gap: .625rem; min-width: 0; padding: .75rem; border: 1px solid var(--wa-border); border-radius: .625rem; background: #f8fafc; }
.wa-metric-emphasis { border-color: #b9e0d0; background: #eef9f4; }
.wa-metrics-admin .wa-metric-emphasis { grid-column: span 2; }
.wa-metric .wa-metric-icon { display: grid; flex: none; place-items: center; width: 1.875rem; height: 1.875rem; border-radius: .5rem; background: #e7f3ed; color: var(--wa-green); }
.wa-metric svg { width: .9375rem; height: .9375rem; }
.wa-metric span, .wa-metric strong { display: block; }
.wa-metric span { color: var(--wa-muted); font-size: .75rem; font-weight: 650; }
.wa-metric strong { margin-top: .25rem; font-size: 1.05rem; line-height: 1.25; overflow-wrap: anywhere; }

.wa-table-wrap { overflow: auto; border: 1px solid var(--wa-border); border-radius: .8125rem; }
.wa-table-wrap:empty { display: none; }
.wa-table { width: 100%; border-collapse: collapse; text-align: left; font-size: .8125rem; font-variant-numeric: tabular-nums; }
.wa-table th, .wa-table td { padding: .75rem .875rem; }
.wa-table th { background: #f1f5f9; color: #334155; white-space: nowrap; }
.wa-table td { border-top: 1px solid #edf2f7; background: white; }
.wa-table tbody tr:nth-child(even) td { background: #f8fafc; }
.wa-table tbody tr:hover td { background: #eef8f3; }
.wa-table td:first-child { font-weight: 700; }
.wa-table-admin :is(th, td):first-child { position: sticky; left: 0; min-width: 8rem; border-right: 1px solid var(--wa-border); }
.wa-empty { padding: 1.25rem; text-align: center; color: var(--wa-muted); }

.wa-log-heading, .wa-log-pagination, .wa-log-pagination > div { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.wa-log-heading { flex-wrap: wrap; }
.wa-log-heading .wa-field-hint { margin-top: .25rem; }
.wa-log-heading .wa-button { display: inline-grid; width: 2.875rem; min-height: 2.875rem; place-items: center; padding: 0; border-color: #08745c; border-radius: .75rem; background: linear-gradient(135deg, #0c8064, #07634e); box-shadow: 0 5px 14px -8px #075b48; }
.wa-log-heading .wa-button:hover:not(:disabled) { background: linear-gradient(135deg, #08745c, #064c3c); box-shadow: 0 7px 16px -8px #075b48; }
.wa-log-refresh-icon { width: 1.25rem; height: 1.25rem; color: #e0fff1; stroke-width: 2.25; transition: transform .25s ease; }
.wa-log-heading .wa-button:hover:not(:disabled) .wa-log-refresh-icon { transform: rotate(45deg); }
.wa-log-heading .wa-button.is-loading .wa-log-refresh-icon { animation: waLogRefresh .8s linear infinite; }
@keyframes waLogRefresh { to { transform: rotate(360deg); } }
@media(prefers-reduced-motion:reduce) { .wa-log-refresh-icon { transition: none; } .wa-log-heading .wa-button.is-loading .wa-log-refresh-icon { animation-duration: 1.6s; } }
.wa-log-list { display: grid; gap: .625rem; margin-top: 1rem; padding: 0; list-style: none; }
.wa-log-list:empty { display: none; }
.wa-log-entry { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: .75rem; padding: .875rem 1rem; border: 1px solid var(--wa-border); border-left: 3px solid #94a3b8; border-radius: .75rem; background: linear-gradient(110deg, #fff, #f8fbf9); }
.wa-log-meta, .wa-log-details { display: flex; min-width: 0; align-items: center; flex-wrap: wrap; gap: .5rem .75rem; }
.wa-log-meta time { color: var(--wa-muted); font-size: .75rem; font-variant-numeric: tabular-nums; }
.wa-log-kind { color: #183c32; font-size: .875rem; font-weight: 750; }
.wa-log-details { justify-content: flex-end; }
.wa-log-status { padding: .25rem .625rem; border-radius: 999px; background: #f1f5f9; color: #475569; font-size: .6875rem; font-weight: 800; text-transform: capitalize; }
.wa-log-status-accepted, .wa-log-status-sent { background: #eaf2ff; color: #2458a6; }
.wa-log-status-delivered, .wa-log-status-read { background: #e4f7ec; color: #08704d; }
.wa-log-status-failed, .wa-log-status-unknown { background: #fff0ed; color: #b93824; }
.wa-log-status-skipped, .wa-log-status-cancelled { background: #fff7df; color: #936300; }
.wa-log-reason, .wa-log-billing { color: var(--wa-muted); font-size: .6875rem; overflow-wrap: anywhere; }
.wa-log-entry:has(.wa-log-status-delivered), .wa-log-entry:has(.wa-log-status-read) { border-left-color: #16a36a; }
.wa-log-entry:has(.wa-log-status-failed), .wa-log-entry:has(.wa-log-status-unknown) { border-left-color: #e4553d; }
.wa-log-entry:has(.wa-log-status-skipped), .wa-log-entry:has(.wa-log-status-cancelled) { border-left-color: #e1a523; }
.wa-log-pagination { margin-top: .875rem; padding-top: .875rem; border-top: 1px solid #edf2f7; }
.wa-log-pagination > div { justify-content: flex-end; }
.wa-log-page-button { min-height: 2.5rem; padding: .5rem .875rem; border: 1px solid #cceadd; border-radius: .625rem; background: #f3faf6; color: #076046; font-size: .8125rem; font-weight: 750; }
.wa-log-page-button:hover:not(:disabled) { background: #e4f5ed; }
.wa-log-page-button:focus-visible { outline: 2px solid #08745c; outline-offset: 3px; }
.wa-log-page-button:disabled { opacity: .45; cursor: not-allowed; }

.wa-section-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; }
.wa-status { display: inline-flex; padding: .25rem .625rem; border-radius: 999px; background: #edf2f1; color: #465f58; font-size: .75rem; font-weight: 700; white-space: nowrap; }
.wa-status-active { background: #dff6e9; color: #076046; }
.wa-service { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .875rem 1rem; border: 1px solid #cceadd; border-radius: .8125rem; background: #eefaf4; }
.wa-service input { width: 1.125rem; height: 1.125rem; }
.wa-template { min-width: 0; padding: .875rem; border: 1px solid var(--wa-border); border-radius: .8125rem; background: #fbfdfc; }
.wa-template:has(input[type="checkbox"]:checked) { border-color: #99cdb9; }
.wa-template-draft { padding: .625rem .75rem; border: 1px solid var(--wa-border); border-radius: .625rem; background: white; }
.wa-template-draft summary { color: var(--wa-green); font-size: .8125rem; font-weight: 700; cursor: pointer; }
.wa-template-draft label { display: block; margin-top: .625rem; }
.wa-template-draft textarea { resize: vertical; }
.wa-template-draft .wa-field-hint { margin: .5rem 0; }
.wa-template-action { padding: .5rem .75rem; border: 1px solid #cceadd; border-radius: .625rem; background: #f3faf6; color: #076046; font-size: .8125rem; font-weight: 700; }
.wa-template-action:hover { background: #e4f5ed; }
.wa-template-action:focus-visible { outline: 2px solid #08745c; outline-offset: 3px; }
.wa-template-action:disabled { opacity: .58; cursor: wait; }

.wa-rate-fields {
    display: grid;
    grid-template-columns: minmax(9rem, 1fr) minmax(9rem, 1fr) minmax(12rem, 2fr) auto;
    align-items: end;
    gap: .75rem;
}
.wa-rate-fields label { min-width: 0; }
.wa-rate-fields .wa-button { min-height: 2.875rem; white-space: nowrap; }

@media (max-width: 960px) {
    .wa-rate-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 480px) {
    .wa-rate-fields { grid-template-columns: minmax(0, 1fr); }
    .wa-log-entry { grid-template-columns: minmax(0, 1fr); }
    .wa-log-details { justify-content: flex-start; }
    .wa-log-pagination { align-items: flex-start; flex-direction: column; }
    .wa-log-pagination > div { width: 100%; }
    .wa-log-pagination .wa-log-page-button { flex: 1; }
}

.wa-recipient-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr)) auto;
    align-items: end;
    gap: .75rem;
    padding: .875rem;
    border: 1px solid var(--wa-border);
    border-radius: .75rem;
    background: #f8fafc;
}
.wa-recipient-form .wa-field { background-color: white; }
.wa-recipient-disable, .wa-recipient-restore {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 2.875rem;
    min-height: 2.875rem;
}
.wa-recipient-disable {
    border-color: #a52539;
    background: #a52539;
    white-space: nowrap;
}
.wa-recipient-disable:hover { border-color: #881b2d; background: #881b2d; }
.wa-recipient-disable:focus-visible { outline-color: #a52539; }
.wa-recipient-feedback, .wa-recipient-status { font-size: .8125rem; }
.wa-recipient-feedback { color: #a52539; }
.wa-recipient-status { padding: 1.25rem 1rem; color: var(--wa-muted); text-align: center; }
.wa-recipient-feedback:empty, .wa-recipient-status:empty { display: none; }
.wa-recipient-table th:last-child, .wa-recipient-action { text-align: right; }
.wa-recipient-table td:nth-child(4), .wa-recipient-table td:nth-child(5), .wa-recipient-restore { white-space: nowrap; }
.wa-recipient-badge {
    display: inline-block;
    padding: .25rem .5rem;
    border-radius: .375rem;
    background: #fff0f2;
    color: #9c2437;
    font-size: .75rem;
    font-weight: 700;
}

@media (max-width: 720px) {
    .wa-recipient-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .wa-recipient-disable { grid-column: 1 / -1; justify-self: start; }
}

@media (max-width: 480px) {
    .wa-recipient-form { grid-template-columns: minmax(0, 1fr); }
    .wa-recipient-disable { justify-self: stretch; }
}

@media (min-width: 760px) {
    .wa-metrics-admin { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (max-width: 360px) {
    .wa-metric { gap: .375rem; padding: .5rem; }
    .wa-metric .wa-metric-icon { width: 1.5rem; height: 1.5rem; }
}

.wa-reminder-panel {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: .75rem;
    padding: .875rem 1rem;
    margin-bottom: .75rem;
    border: 1px solid #cceadd;
    border-radius: .8125rem;
    background: #f0faf5;
}

.wa-reminder-panel label { flex: 0 1 18rem; font-size: .8125rem; font-weight: 750; color: #163b31; }
.wa-reminder-panel .wa-button { display: inline-flex; align-items: center; gap: .5rem; min-height: 2.875rem; }
.wa-reminder-panel .wa-button svg { width: 1rem; height: 1rem; }
.wa-reminder-recipient { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .625rem; }
.wa-reminder-recipient button { color: #08745c; font-weight: 750; }

@media (max-width: 480px) {
    .wa-reminder-panel label, .wa-reminder-panel .wa-button { flex: 1 1 100%; }
    .wa-reminder-panel .wa-button { justify-content: center; }
}

@media (forced-colors: active) {
    select.wa-field { appearance: auto; background-image: none; }
}
