* {
    box-sizing: border-box;
}

:root {
    --bg: #f4f8ff;
    --bg-soft: #edf4ff;
    --panel: #ffffff;
    --panel-soft: #f8fbff;
    --line: #d7e6ff;
    --line-strong: #bdd4ff;
    --text: #12335f;
    --muted: #6d88ab;
    --primary: #2f6fed;
    --primary-dark: #2158c5;
    --primary-soft: #e8f1ff;
    --success: #2f6fed;
    --success-soft: #eef4ff;
    --warning: #5b84dc;
    --warning-soft: #f2f7ff;
    --danger: #1f4fbe;
    --danger-soft: #edf4ff;
    --info: #3c7dff;
    --info-soft: #edf4ff;
    --shadow-sm: 0 8px 22px rgba(32, 83, 170, 0.08);
    --shadow-md: 0 18px 45px rgba(32, 83, 170, 0.12);
    --radius-xl: 28px;
    --radius-lg: 20px;
    --radius-md: 16px;
    --radius-sm: 12px;
}

html,
body {
    margin: 0;
    padding: 0;
    min-height: 100%;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(47, 111, 237, 0.1), transparent 28%),
        radial-gradient(circle at top right, rgba(125, 177, 255, 0.16), transparent 24%),
        linear-gradient(180deg, #f9fbff 0%, #eef5ff 100%);
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
select,
textarea {
    font: inherit;
}

body.sensitive-view {
    -webkit-user-select: none;
    user-select: none;
}

body.sensitive-view input,
body.sensitive-view select,
body.sensitive-view textarea,
body.sensitive-view button,
body.sensitive-view a.button {
    -webkit-user-select: auto;
    user-select: auto;
}

.app-shell {
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr);
    min-height: 100vh;
}

.sidebar {
    position: sticky;
    top: 0;
    align-self: start;
    height: 100vh;
    overflow-y: auto;
    padding: 26px 20px;
    background: linear-gradient(180deg, #ffffff 0%, #f5f9ff 100%);
    border-right: 1px solid var(--line);
    box-shadow: 12px 0 30px rgba(50, 90, 160, 0.04);
}

.brand-box {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px;
    background: linear-gradient(180deg, #f8fbff 0%, #eef5ff 100%);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    margin-bottom: 22px;
}

.brand-mark {
    width: 50px;
    height: 50px;
    border-radius: 16px;
    display: grid;
    place-items: center;
    font-weight: 800;
    color: #ffffff;
    letter-spacing: 0.08em;
    background: linear-gradient(135deg, var(--primary), #69a6ff);
    box-shadow: 0 16px 30px rgba(47, 111, 237, 0.28);
}

.brand-title {
    font-size: 1.06rem;
    font-weight: 800;
}

.brand-subtitle {
    color: var(--muted);
    font-size: 0.86rem;
    margin-top: 2px;
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.nav-link,
.nav-link-button {
    display: block;
    width: 100%;
    padding: 13px 15px;
    border: 1px solid transparent;
    border-radius: 15px;
    background: #ffffff;
    color: var(--text);
    font-weight: 600;
    box-shadow: 0 2px 0 rgba(255, 255, 255, 0.6) inset;
    transition: 0.2s ease;
}

.nav-link:hover,
.nav-link.active,
.nav-link-button:hover {
    transform: translateX(2px);
    border-color: var(--line-strong);
    background: linear-gradient(180deg, #f3f8ff 0%, #eaf2ff 100%);
    color: var(--primary-dark);
}

.nav-link-danger,
.nav-link-danger:hover {
    color: var(--primary-dark);
}

.nav-link-button {
    text-align: left;
    appearance: none;
    cursor: pointer;
}

.nav-logout-form,
.topbar-logout-form,
.inline-form,
.clean-inline-form {
    margin: 0;
}

.sidebar-card {
    margin-top: 22px;
    padding: 18px;
    border-radius: var(--radius-lg);
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
    border: 1px solid var(--line);
    box-shadow: var(--shadow-sm);
}

.nav-link-logout {
    margin-top: 14px;
    text-align: center;
    background: linear-gradient(180deg, #eef5ff 0%, #e5efff 100%);
    border-color: var(--line);
}

.nav-link-logout:hover {
    background: linear-gradient(180deg, #e6f0ff 0%, #dcebff 100%);
}

.meta-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 12px;
}

.tiny-note,
.muted,
.helper-text,
.panel-subtitle,
.topbar-subtitle,
.small {
    color: var(--muted);
}

.main-panel {
    padding: 28px;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 22px;
}

.topbar h1 {
    margin: 0;
    font-size: clamp(1.58rem, 2vw, 2.25rem);
    line-height: 1.1;
}

.topbar-subtitle {
    margin: 8px 0 0;
}

.topbar-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.pill {
    padding: 11px 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid var(--line);
    box-shadow: var(--shadow-sm);
    white-space: nowrap;
}

.panel,
.stat-card,
.note-box,
.auth-card,
.preview-frame {
    background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.panel {
    padding: 22px;
}

.panel-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.panel-title {
    margin: 0;
    font-size: 1.12rem;
    font-weight: 800;
    color: var(--text);
}

.section-grid {
    display: grid;
    gap: 20px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
}

.stat-card {
    padding: 22px;
}

.stat-label {
    font-size: 0.92rem;
    color: var(--muted);
    margin-bottom: 10px;
}

.stat-value {
    font-size: clamp(1.65rem, 2vw, 2.2rem);
    font-weight: 800;
    color: var(--primary-dark);
    line-height: 1;
}

.stat-trend {
    margin-top: 10px;
    color: var(--muted);
    font-size: 0.92rem;
}

.progress-list,
.list-stack,
.info-list {
    display: grid;
    gap: 14px;
}

.progress-item {
    padding: 14px 16px;
    border-radius: var(--radius-md);
    background: var(--panel-soft);
    border: 1px solid var(--line);
}

.progress-head,
.item-line {
    display: flex;
    gap: 12px;
    justify-content: space-between;
    align-items: flex-start;
}

.progress-bar {
    height: 10px;
    border-radius: 999px;
    overflow: hidden;
    background: #e4efff;
    margin-top: 12px;
}

.progress-fill {
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--primary), #78aeff);
}

.item-line {
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: var(--panel-soft);
}

.info-list .item-line {
    padding: 0;
    background: transparent;
    border: 0;
    border-bottom: 1px dashed var(--line);
    padding-bottom: 10px;
}

.info-list .item-line:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}

.right {
    text-align: right;
}

.filter-bar,
.action-toolbar {
    display: grid;
    gap: 16px;
}

.database-chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 18px;
}

.database-toolbar,
.database-toolbar-actions,
.database-toolbar-actions-wrap,
.import-panel-head,
.followup-actions,
.action-row,
.action-card-row,
.bulk-toolbar,
.bulk-toolbar-left,
.bulk-toolbar-right {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}

.database-toolbar {
    justify-content: space-between;
}

.database-toolbar-actions {
    justify-content: flex-end;
}

.compact-filter-inline {
    margin: 0;
}

.action-toolbar {
    margin-bottom: 16px;
}

.action-card {
    padding: 16px 18px;
    background: linear-gradient(180deg, #f9fbff 0%, #f3f8ff 100%);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
}

.action-card-title {
    font-weight: 800;
    margin-bottom: 12px;
}

.action-card-row {
    justify-content: space-between;
}

.action-field {
    min-width: 220px;
}

.action-field-wide {
    min-width: 280px;
}

.import-panel {
    padding: 18px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}

.bulk-toolbar {
    justify-content: space-between;
    padding: 16px 18px;
    background: linear-gradient(180deg, #f9fbff 0%, #f3f8ff 100%);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
}

.bulk-toolbar-left {
    align-items: center;
}

.bulk-toolbar-right {
    justify-content: flex-end;
}

.bulk-toolbar-right-wide {
    flex: 1;
}

.check-inline {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
}

.kbd {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    border-radius: 8px;
    background: #eff5ff;
    border: 1px solid var(--line);
    font-size: 0.88rem;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 7px 11px;
    border-radius: 999px;
    font-size: 0.83rem;
    font-weight: 700;
    border: 1px solid transparent;
}

.badge-light {
    background: #edf4ff;
    color: var(--primary-dark);
    border-color: #d4e5ff;
}

.badge-info {
    background: #edf4ff;
    color: #2e67d6;
    border-color: #d9e8ff;
}

.badge-success {
    background: #e9f2ff;
    color: #245ccc;
    border-color: #d7e5ff;
}

.badge-warning {
    background: #f4f8ff;
    color: #4e75c3;
    border-color: #dce7ff;
}

.badge-danger {
    background: #eef4ff;
    color: #1f4fbe;
    border-color: #dce8ff;
}

.button {
    appearance: none;
    border: 1px solid transparent;
    background: linear-gradient(180deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: #ffffff;
    border-radius: 14px;
    padding: 12px 16px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 14px 24px rgba(47, 111, 237, 0.2);
    transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}

.button:hover {
    transform: translateY(-1px);
    box-shadow: 0 16px 28px rgba(47, 111, 237, 0.24);
}

.button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.button-secondary,
.button-ghost {
    background: linear-gradient(180deg, #ffffff 0%, #f2f7ff 100%);
    color: var(--primary-dark);
    border-color: var(--line-strong);
    box-shadow: var(--shadow-sm);
}


.button-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.button-group-stretch > .button,
.button-group-stretch > a.button {
    flex: 1 1 180px;
    text-align: center;
}

.button-light {
    background: #ffffff;
    color: var(--primary-dark);
    border-color: var(--line-strong);
    box-shadow: var(--shadow-sm);
}

.button-success {
    background: linear-gradient(180deg, #2f6fed 0%, #1f57c7 100%);
}

.button-danger {
    background: linear-gradient(180deg, #245ccc 0%, #173d92 100%);
}

.button-info {
    background: linear-gradient(180deg, #3a86ff 0%, #1f6fff 100%);
}

.button-small {
    padding: 8px 12px;
    min-height: 36px;
    font-size: 0.85rem;
}

.wrap-actions {
    flex-wrap: wrap;
}

textarea {
    width: 100%;
    border-radius: var(--radius-md);
    border: 1px solid var(--line);
    background: #fff;
    padding: 12px 14px;
    font: inherit;
    resize: vertical;
}

.alert {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    border: 1px solid var(--line);
    box-shadow: var(--shadow-sm);
}

.alert-success {
    background: #eef4ff;
    border-color: #d7e5ff;
}

.alert-warning {
    background: #f4f8ff;
    border-color: #dce7ff;
}

.alert-error,
.alert-danger {
    background: #edf4ff;
    border-color: #d7e5ff;
}

.alert-info {
    background: #edf4ff;
    border-color: #d8e8ff;
}

.alert-close {
    border: 0;
    background: transparent;
    color: var(--muted);
    font-size: 1.2rem;
    cursor: pointer;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 16px;
}

.compact-form {
    align-items: end;
}

.field {
    display: grid;
    gap: 8px;
}

.field label {
    font-size: 0.92rem;
    color: var(--muted);
    font-weight: 700;
}

input[type="text"],
input[type="password"],
input[type="file"],
select,
textarea {
    width: 100%;
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: #ffffff;
    color: var(--text);
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(47, 111, 237, 0.12);
}

.form-col-1 { grid-column: span 1; }
.form-col-3 { grid-column: span 3; }
.form-col-4 { grid-column: span 4; }
.form-col-5 { grid-column: span 5; }
.form-col-6 { grid-column: span 6; }
.form-col-8 { grid-column: span 8; }
.form-col-12 { grid-column: 1 / -1; }

.table-responsive {
    width: 100%;
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: #ffffff;
}

.table {
    width: 100%;
    border-collapse: collapse;
    min-width: 880px;
}

.table th,
.table td {
    padding: 14px 15px;
    border-bottom: 1px solid #e9f1ff;
    vertical-align: top;
    text-align: left;
}

.table thead th {
    font-size: 0.9rem;
    color: var(--muted);
    background: #f7faff;
    font-weight: 800;
}

.table tbody tr:hover {
    background: #fbfdff;
}

.phone-cell {
    font-weight: 700;
    color: var(--primary-dark);
}

.database-actions-cell {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.followup-list {
    display: grid;
    gap: 16px;
}

.followup-card {
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
    box-shadow: var(--shadow-sm);
    transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
}

.followup-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.followup-card-body {
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) minmax(280px, 0.9fr);
    gap: 20px;
    padding: 22px;
}

.followup-card-main,
.followup-card-side {
    display: grid;
    gap: 14px;
}

.followup-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.followup-name {
    margin: 0;
    font-size: 1.28rem;
    font-weight: 800;
}

.followup-phone-wrap {
    padding: 18px;
    border: 1px solid #dce8ff;
    border-radius: var(--radius-md);
    background: linear-gradient(180deg, #f9fbff 0%, #eef5ff 100%);
}

.followup-phone-label {
    font-size: 0.9rem;
    color: var(--muted);
    margin-bottom: 6px;
    font-weight: 700;
}

.followup-phone {
    font-size: clamp(1.45rem, 2.5vw, 1.9rem);
    line-height: 1.1;
    font-weight: 800;
    letter-spacing: 0.01em;
    color: var(--primary-dark);
    word-break: break-word;
}

.followup-actions {
    align-items: stretch;
}

.followup-actions .button {
    flex: 1;
}

.followup-note-box {
    margin-bottom: 18px;
}

.note-box {
    padding: 16px 18px;
    background: linear-gradient(180deg, #f7faff 0%, #eef5ff 100%);
}

.empty-state {
    padding: 36px 20px;
    text-align: center;
    border: 1px dashed var(--line-strong);
    border-radius: var(--radius-lg);
    background: linear-gradient(180deg, #fbfdff 0%, #f4f8ff 100%);
    color: var(--muted);
}

.auth-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.auth-card {
    width: min(100%, 520px);
    padding: 28px;
}

.auth-brand {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 18px;
}

.auth-title {
    margin: 0;
    font-size: 1.52rem;
}

.auth-subtitle {
    margin: 5px 0 0;
}

.page-footer {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    color: var(--muted);
    font-size: 0.9rem;
    padding: 18px 2px 4px;
}

.preview-frame {
    width: 100%;
    min-height: 600px;
    border: 0;
}

.filter-submit-wrap,
.import-submit-wrap {
    display: flex;
    align-items: end;
}

.button-full-mobile {
    white-space: nowrap;
}

@media (max-width: 1200px) {
    .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .followup-card-body {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 980px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
        height: auto;
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }

    .main-panel {
        padding: 20px;
    }

    .topbar,
    .panel-header,
    .database-toolbar,
    .action-card-row,
    .bulk-toolbar,
    .item-line,
    .progress-head {
        flex-direction: column;
        align-items: flex-start;
    }

    .topbar-actions,
    .database-toolbar-actions,
    .bulk-toolbar-right {
        width: 100%;
        justify-content: flex-start;
    }

    .section-grid[style],
    .section-grid {
        grid-template-columns: 1fr !important;
    }

    .action-field,
    .action-field-wide {
        width: 100%;
        min-width: 0;
    }

    .button-full-mobile,
    .followup-actions .button,
    .topbar-logout-button {
        width: 100%;
    }
}

@media (max-width: 760px) {
    .main-panel {
        padding: 16px;
    }

    .panel,
    .stat-card,
    .auth-card {
        padding: 18px;
    }

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

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

    .form-col-1,
    .form-col-3,
    .form-col-4,
    .form-col-5,
    .form-col-6,
    .form-col-8,
    .form-col-12 {
        grid-column: auto;
    }

    .table-stack-mobile {
        min-width: 100%;
    }

    .table-stack-mobile thead {
        display: none;
    }

    .table-stack-mobile,
    .table-stack-mobile tbody,
    .table-stack-mobile tr,
    .table-stack-mobile td {
        display: block;
        width: 100%;
    }

    .table-stack-mobile tr {
        border-bottom: 1px solid #e7efff;
        padding: 12px 0;
    }

    .table-stack-mobile td {
        border: 0;
        padding: 7px 14px;
    }

    .table-stack-mobile td::before {
        content: attr(data-label);
        display: block;
        font-size: 0.79rem;
        color: var(--muted);
        font-weight: 800;
        margin-bottom: 4px;
    }

    .table-responsive {
        overflow: visible;
    }

    .table {
        min-width: 100%;
    }

    .database-actions-cell {
        width: 100%;
    }

    .database-actions-cell .button,
    .action-row .button,
    .action-row .inline-form,
    .inline-form .button {
        width: 100%;
    }

    .followup-card-body {
        padding: 18px;
    }

    .followup-phone {
        font-size: 1.62rem;
    }

    .page-footer {
        flex-direction: column;
    }
}

.brand-logo-image {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 16px;
    border: 1px solid var(--line);
    background: #fff;
}

.auth-card-clean {
    width: min(100%, 460px);
}

.auth-brand-clean {
    margin-bottom: 22px;
}

.topbar-subtitle,
.note-box.followup-note-box {
    display: none;
}

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

.followup-list-clean {
    gap: 14px;
}

.followup-card-clean {
    border-radius: 22px;
    background: #fff;
}

.followup-card-body-vertical {
    grid-template-columns: 1fr;
    gap: 16px;
}

.followup-actions-inline {
    justify-content: flex-start;
}

.followup-option-title {
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--muted);
}

.followup-option-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.followup-option-chip {
    appearance: none;
    border: 1px solid var(--line);
    background: #f7fbff;
    color: var(--primary-dark);
    border-radius: 999px;
    padding: 9px 12px;
    font-weight: 700;
    cursor: pointer;
    transition: .15s ease;
}

.followup-option-chip:hover {
    background: #eaf3ff;
    border-color: var(--line-strong);
}

.followup-option-chip:disabled {
    opacity: .65;
    cursor: wait;
}

.followup-phone {
    font-size: clamp(1.75rem, 3vw, 2.2rem);
}

.page-footer {
    justify-content: center;
}


.button-whatsapp { background: linear-gradient(180deg, #1fbe63 0%, #149e50 100%); border-color: #149e50; color: #fff; }
.button-whatsapp:hover { color: #fff; filter: brightness(1.02); }
.button-icon-only { width: 46px; min-width: 46px; padding: 0; display: inline-flex; align-items: center; justify-content: center; font-size: 1.1rem; }
.modal-open { overflow: hidden; }
.modal { position: fixed; inset: 0; background: rgba(15, 35, 67, 0.45); display: none; align-items: center; justify-content: center; padding: 20px; z-index: 2000; }
.modal.is-open { display: flex; }
.modal-dialog { width: min(100%, 640px); }
.modal-dialog.modal-lg { width: min(100%, 860px); }
.modal-card { background: #fff; border: 1px solid var(--line); border-radius: 24px; box-shadow: var(--shadow-md); padding: 22px; }
.modal-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.modal-title { margin: 0; font-size: 1.2rem; }
.modal-close { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: #fff; cursor: pointer; font-size: 1.5rem; line-height: 1; color: var(--text); }
.followup-phone { font-size: clamp(1.4rem, 2.2vw, 1.9rem); font-weight: 800; }
@media (max-width: 768px) { .modal-card { padding: 18px; border-radius: 18px; } }

.topbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-toggle-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.database-toolbar-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
}

.check-inline {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

body.sidebar-collapsed .app-shell {
    grid-template-columns: 0 minmax(0, 1fr);
}

body.sidebar-collapsed .sidebar {
    width: 0;
    min-width: 0;
    padding: 0;
    border-right: 0;
    overflow: hidden;
    opacity: 0;
}

@media (max-width: 980px) {
    body.sidebar-collapsed .app-shell {
        grid-template-columns: 1fr;
    }

    body.sidebar-collapsed .sidebar {
        display: none;
    }

    .topbar-left {
        width: 100%;
    }
}


.compact-action-row {
    gap: 8px;
}

.icon-action-button {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: #ffffff;
    color: var(--primary-dark);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
    font-size: 1rem;
}

.icon-action-button:hover {
    transform: translateY(-1px);
    border-color: #b8d1ff;
    box-shadow: var(--shadow-md);
}

.icon-action-button.danger {
    color: #1d4fb4;
    background: #eef4ff;
}

.topbar-actions .pill {
    min-width: 0;
}

@media (max-width: 980px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        width: min(84vw, 320px);
        height: 100dvh;
        z-index: 1200;
        border-right: 1px solid var(--line);
        border-bottom: 0;
        transform: translateX(-102%);
        transition: transform .22s ease, opacity .22s ease;
        opacity: 0;
        overflow-y: auto;
    }

    .main-panel {
        padding: 20px 16px;
    }

    body.sidebar-open .sidebar {
        transform: translateX(0);
        opacity: 1;
        box-shadow: 0 16px 40px rgba(25, 56, 120, 0.18);
    }

    body.sidebar-open::before {
        content: '';
        position: fixed;
        inset: 0;
        background: rgba(18, 35, 68, 0.34);
        z-index: 1100;
    }

    body.sidebar-collapsed .sidebar {
        display: block;
    }
}

@media (max-width: 760px) {
    .topbar-actions {
        width: 100%;
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
    }

    .topbar-actions .pill {
        width: 100%;
        text-align: center;
        justify-content: center;
    }
}

/* v5.7 responsive refinements */
.modal-dialog {
    max-height: calc(100dvh - 40px);
}

.modal-card {
    max-height: calc(100dvh - 40px);
    overflow: auto;
}

@media (max-width: 980px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        width: min(78vw, 290px);
        padding: 20px 16px;
    }

    .main-panel {
        width: 100%;
        min-width: 0;
        padding: 18px 14px 24px;
    }

    .topbar {
        position: sticky;
        top: 0;
        z-index: 1000;
        padding: 12px 0 10px;
        background: linear-gradient(180deg, rgba(244, 248, 255, 0.96) 0%, rgba(244, 248, 255, 0.88) 100%);
        backdrop-filter: blur(8px);
    }

    .topbar-actions {
        width: 100%;
        justify-content: flex-start;
    }

    .database-toolbar-actions {
        width: 100%;
        justify-content: flex-start;
    }

    .database-toolbar-actions .button,
    .database-toolbar-actions a.button {
        flex: 1 1 calc(50% - 10px);
        min-width: 150px;
    }
}

@media (max-width: 640px) {
    .sidebar {
        width: min(84vw, 280px);
        border-top-right-radius: 18px;
        border-bottom-right-radius: 18px;
    }

    .topbar h1 {
        font-size: 1.36rem;
    }

    .database-toolbar-actions .button,
    .database-toolbar-actions a.button {
        flex: 1 1 100%;
        min-width: 0;
    }

    .pill {
        width: 100%;
        text-align: center;
    }
}

.is-hidden { display: none !important; }
.sync-indicator-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}
.sync-pill {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 999px;
  background: #e9f2ff;
  color: #1f6fff;
  font-size: 13px;
  font-weight: 600;
}
.sync-pill[data-state="offline"] {
  background: #fff4dc;
  color: #9a6200;
}
.sync-pill-muted {
  background: #eef3fb;
  color: #5f728a;
}
.sync-pill-light {
  background: #f7faff;
  color: #6f83a0;
}
@media (max-width: 980px) {
  .sync-indicator-row {
    gap: 8px;
  }
  .sync-pill {
    font-size: 12px;
    padding: 7px 10px;
  }
}


.backup-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}
.backup-hero-badges {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.backup-action-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
}
.backup-action-card {
    background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
    border: 1px solid var(--line);
    border-radius: 22px;
    box-shadow: var(--shadow-sm);
    padding: 22px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.backup-action-card h3 { margin: 0; font-size: 1.08rem; }
.backup-action-card p { margin: 0; color: var(--muted); line-height: 1.55; }
.backup-action-icon {
    width: 52px;
    height: 52px;
    border-radius: 16px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, #2f6fed, #7eb0ff);
    color: #fff;
    font-size: 1.4rem;
    font-weight: 800;
    box-shadow: 0 16px 30px rgba(47, 111, 237, 0.2);
}
.backup-action-card-danger .backup-action-icon {
    background: linear-gradient(135deg, #1f4fbe, #5e8dff);
}
.modal-warning-box {
    border-radius: 16px;
    background: #f3f7ff;
    border: 1px solid var(--line);
    color: var(--text);
    padding: 14px 16px;
    line-height: 1.6;
}
.modal-footer-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}
.button.button-ghost {
    background: #fff;
    color: var(--text);
    border: 1px solid var(--line);
}
.button.button-ghost:hover {
    background: var(--primary-soft);
    border-color: var(--line-strong);
}
@media (max-width: 980px) {
    .backup-action-grid { grid-template-columns: 1fr; }
    .backup-hero { flex-direction: column; align-items: flex-start; }
}
@media (max-width: 640px) {
    .modal-footer-actions { flex-direction: column-reverse; }
    .modal-footer-actions .button { width: 100%; }
}


.followup-filter-row{display:flex;flex-wrap:wrap;gap:10px;align-items:center}.filter-chip{border:1px solid #cfe0ff;background:#fff;color:#1f5ed6;border-radius:999px;padding:9px 14px;font-weight:600;cursor:pointer;transition:.2s}.filter-chip.is-active,.filter-chip:hover{background:#1f5ed6;color:#fff;border-color:#1f5ed6}.compact-filter-inline-stack{display:flex;flex-direction:column;align-items:flex-end;gap:12px}.followup-option-title{font-weight:700;margin-bottom:10px}@media (max-width:980px){.compact-filter-inline-stack{align-items:stretch}.followup-filter-row{overflow:auto;white-space:nowrap;padding-bottom:2px}}

.stats-grid-four {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.user-monitor-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 18px;
}

.user-monitor-card {
    border: 1px solid var(--border-color);
    background: #fff;
    border-radius: 20px;
    padding: 18px;
    box-shadow: 0 14px 32px rgba(31, 111, 255, 0.06);
    display: grid;
    gap: 14px;
}

.user-monitor-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.user-monitor-metrics {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.metric-box {
    background: #f8fbff;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 12px 14px;
    display: grid;
    gap: 4px;
}

.metric-label {
    font-size: 12px;
    color: var(--muted-color);
}

.compact-progress-item {
    gap: 8px;
}

.progress-fill-alt {
    background: linear-gradient(90deg, #22c55e 0%, #16a34a 100%);
}

@media (max-width: 1100px) {
    .stats-grid-four {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .stats-grid-four,
    .user-monitor-metrics {
        grid-template-columns: 1fr;
    }
}


/* dashboard refresh */
.dashboard-shell{gap:24px}
.dashboard-hero{display:grid;grid-template-columns:minmax(0,1.45fr) minmax(280px,.85fr);gap:22px;padding:26px 26px 24px;background:linear-gradient(135deg,#ffffff 0%,#f4f8ff 45%,#edf4ff 100%);overflow:hidden;position:relative}
.dashboard-hero:before{content:"";position:absolute;right:-60px;top:-60px;width:220px;height:220px;background:radial-gradient(circle,rgba(47,111,237,.16),transparent 68%);pointer-events:none}
.dashboard-chip{display:inline-flex;align-items:center;padding:8px 12px;border-radius:999px;background:#eaf2ff;color:#235ed1;font-size:.82rem;font-weight:800;margin-bottom:14px}
.dashboard-hero-title{margin:0 0 10px;font-size:clamp(1.3rem,2vw,2rem);line-height:1.18;color:#12335f}
.dashboard-hero-text{margin:0;color:#647fa3;max-width:760px}
.dashboard-hero-metrics{display:grid;grid-template-columns:1fr;gap:14px;align-content:center}
.hero-metric-card{padding:18px 18px 16px;border-radius:20px;background:rgba(255,255,255,.88);border:1px solid #d9e7ff;box-shadow:0 12px 30px rgba(44,95,180,.08);display:grid;gap:6px}
.hero-metric-card strong{font-size:1.9rem;line-height:1;color:#1c4fb8}
.hero-metric-label{font-size:.82rem;color:#6e87a7;font-weight:700;text-transform:uppercase;letter-spacing:.04em}
.hero-metric-card small{color:#6e87a7}
.hero-metric-card-accent{background:linear-gradient(135deg,#2f6fed 0%,#73aaff 100%);border-color:transparent}
.hero-metric-card-accent .hero-metric-label,.hero-metric-card-accent strong,.hero-metric-card-accent small{color:#fff}
.dashboard-stats-grid .stat-card{position:relative;overflow:hidden;padding:24px;border-radius:22px;box-shadow:0 14px 34px rgba(37,88,184,.08)}
.dashboard-stats-grid .stat-card:after{content:"";position:absolute;right:-24px;bottom:-24px;width:110px;height:110px;border-radius:50%;background:rgba(255,255,255,.38)}
.stat-icon-badge{display:inline-flex;align-items:center;justify-content:center;min-width:46px;height:34px;padding:0 12px;border-radius:999px;background:#eaf2ff;color:#235ed1;font-weight:800;font-size:.82rem;margin-bottom:18px}
.stat-icon-badge-green{background:#e8fff1;color:#149d52}
.stat-card-phone-done{background:linear-gradient(180deg,#ffffff 0%,#f6faff 100%)}
.stat-card-phone-pending{background:linear-gradient(180deg,#ffffff 0%,#fbfcff 100%)}
.stat-card-wa-done{background:linear-gradient(180deg,#ffffff 0%,#f4fff8 100%)}
.stat-card-wa-pending{background:linear-gradient(180deg,#ffffff 0%,#f9fffb 100%)}
.dashboard-progress-grid{display:grid;grid-template-columns:minmax(320px,.95fr) minmax(0,1.05fr);gap:22px}
.dashboard-panel-header{margin-bottom:16px}
.dashboard-progress-panel,.dashboard-activity-panel,.dashboard-monitor-panel{padding:24px}
.dashboard-progress-list{gap:16px}
.dashboard-progress-item{background:linear-gradient(180deg,#f9fbff 0%,#f3f8ff 100%);border-color:#dbe8ff;padding:16px 18px}
.progress-fill-purple{background:linear-gradient(90deg,#7c4dff 0%,#ac82ff 100%)}
.dashboard-activity-list{gap:12px}
.dashboard-activity-item{background:linear-gradient(180deg,#fcfdff 0%,#f5f9ff 100%);border-color:#dbe7ff;padding:15px 16px}
.dashboard-time{white-space:nowrap}
.dashboard-user-grid{gap:20px}
.dashboard-user-card{border:1px solid #dbe8ff;background:linear-gradient(180deg,#ffffff 0%,#f9fbff 100%);border-radius:22px;padding:20px;box-shadow:0 14px 34px rgba(31,111,255,.07)}
.dashboard-user-metrics{gap:10px}
.dashboard-metric-box{background:#f7faff;border:1px solid #dce8ff;border-radius:16px;padding:12px 14px}
.dashboard-metric-box-green{background:#f5fff8;border-color:#d8f1e2}
.metric-label{font-size:12px;color:#6b85a6}
.user-monitor-card .progress-bar{margin-top:10px}
@media (max-width:1100px){.dashboard-hero,.dashboard-progress-grid{grid-template-columns:1fr}.dashboard-stats-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media (max-width:640px){.dashboard-hero,.dashboard-progress-panel,.dashboard-activity-panel,.dashboard-monitor-panel{padding:18px}.dashboard-stats-grid{grid-template-columns:1fr}.dashboard-activity-item,.dashboard-progress-item{padding:14px}.dashboard-time{white-space:normal}}

/* dashboard monitoring per user refresh */
.dashboard-user-card-v2{
    padding:22px;
    background:linear-gradient(180deg,#ffffff 0%,#f8fbff 100%);
    border:1px solid #d8e6ff;
    box-shadow:0 18px 40px rgba(36,88,180,.08);
    gap:16px;
}
.dashboard-user-top{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:14px;
}
.dashboard-user-identity{
    display:flex;
    align-items:center;
    gap:14px;
    min-width:0;
}
.dashboard-user-avatar{
    width:48px;
    height:48px;
    border-radius:16px;
    display:grid;
    place-items:center;
    font-weight:800;
    color:#fff;
    background:linear-gradient(135deg,#2f6fed 0%,#7bb1ff 100%);
    box-shadow:0 12px 24px rgba(47,111,237,.22);
    flex:0 0 auto;
}
.dashboard-user-name{
    display:block;
    font-size:1rem;
    line-height:1.2;
}
.dashboard-user-total-pill{
    min-width:84px;
    padding:10px 12px;
    border-radius:16px;
    background:linear-gradient(180deg,#edf4ff 0%,#e6f0ff 100%);
    border:1px solid #d3e3ff;
    text-align:right;
}
.dashboard-user-total-pill span{
    display:block;
    font-size:.74rem;
    color:#6f89aa;
    text-transform:uppercase;
    letter-spacing:.04em;
    margin-bottom:2px;
}
.dashboard-user-total-pill strong{
    font-size:1.1rem;
    color:#184cad;
}
.dashboard-user-stat-grid{
    display:grid;
    grid-template-columns:repeat(2,minmax(0,1fr));
    gap:14px;
}
.dashboard-user-stat{
    border-radius:18px;
    padding:16px;
    border:1px solid #dce8ff;
    background:linear-gradient(180deg,#ffffff 0%,#f6faff 100%);
    display:grid;
    gap:12px;
}
.dashboard-user-stat-wa{
    background:linear-gradient(180deg,#ffffff 0%,#f5fff8 100%);
    border-color:#d8f0e1;
}
.dashboard-user-stat-head{
    display:flex;
    align-items:flex-start;
    justify-content:space-between;
    gap:10px;
}
.dashboard-user-stat-head strong{
    font-size:1.15rem;
    color:#184cad;
}
.dashboard-user-stat-wa .dashboard-user-stat-head strong{
    color:#13884a;
}
.dashboard-user-stat-label{
    font-size:.82rem;
    font-weight:800;
    text-transform:uppercase;
    letter-spacing:.04em;
    color:#6984a8;
}
.dashboard-user-stat-nums{
    display:grid;
    grid-template-columns:repeat(2,minmax(0,1fr));
    gap:10px;
}
.dashboard-user-stat-nums div{
    border-radius:14px;
    background:rgba(255,255,255,.8);
    border:1px solid #e3edff;
    padding:10px 12px;
}
.dashboard-user-stat-wa .dashboard-user-stat-nums div{
    border-color:#e0f3e6;
}
.dashboard-user-stat-nums span{
    display:block;
    font-size:.76rem;
    color:#7a92b1;
    margin-bottom:4px;
}
.dashboard-user-stat-nums strong{
    font-size:1rem;
    color:#163f97;
}
.dashboard-user-stat-wa .dashboard-user-stat-nums strong{
    color:#157546;
}
.dashboard-mini-progress{
    height:10px;
    border-radius:999px;
    background:#e9f1ff;
    overflow:hidden;
}
.dashboard-user-bottom{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:14px;
    border-top:1px solid #e6eefc;
    padding-top:14px;
}
.dashboard-user-overall span{
    display:block;
    font-size:.76rem;
    text-transform:uppercase;
    letter-spacing:.04em;
    color:#7a91b0;
    margin-bottom:3px;
}
.dashboard-user-overall strong{
    font-size:1.2rem;
    color:#143a8a;
}
.dashboard-user-summary{
    font-size:.86rem;
    color:#6882a4;
    text-align:right;
}
@media (max-width: 860px){
    .dashboard-user-stat-grid{grid-template-columns:1fr;}
    .dashboard-user-bottom{flex-direction:column;align-items:flex-start;}
    .dashboard-user-summary{text-align:left;}
}
@media (max-width: 560px){
    .dashboard-user-top{align-items:flex-start;}
    .dashboard-user-total-pill{min-width:72px;padding:9px 10px;}
    .dashboard-user-avatar{width:42px;height:42px;border-radius:14px;}
    .dashboard-user-stat-nums{grid-template-columns:1fr 1fr;}
}

/* dashboard monitoring bubble split */
.dashboard-monitor-split{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:22px}
.dashboard-monitor-column{display:grid;gap:14px}
.dashboard-monitor-heading h3{margin:0;font-size:1rem;color:#163f97}
.dashboard-monitor-heading span{display:block;margin-top:4px;font-size:.82rem;color:#6f86a8}
.dashboard-user-grid-bubble{grid-template-columns:1fr;gap:14px}
.dashboard-user-bubble{padding:18px;border-radius:20px;display:grid;gap:14px}
.dashboard-user-bubble-phone{background:linear-gradient(180deg,#ffffff 0%,#f6f9ff 100%);border:1px solid #d8e5ff}
.dashboard-user-bubble-wa{background:linear-gradient(180deg,#ffffff 0%,#f5fff8 100%);border:1px solid #d8efe2}
.dashboard-user-bubble-head{display:flex;align-items:center;gap:12px}
.dashboard-user-avatar-wa{background:linear-gradient(135deg,#0f9d58 0%,#76d39c 100%);box-shadow:0 12px 24px rgba(15,157,88,.18)}
.dashboard-bubble-metric-list{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px}
.dashboard-bubble-metric-item{padding:12px 13px;border-radius:16px;background:#edf4ff;border:1px solid #d7e5ff}
.dashboard-bubble-metric-item-wa{background:#effcf4;border-color:#d8efe0}
.dashboard-bubble-metric-item span{display:block;font-size:.72rem;line-height:1.35;color:#7088ab;margin-bottom:6px}
.dashboard-bubble-metric-item strong{display:block;font-size:1.05rem;color:#163f97}
.dashboard-bubble-metric-item-wa strong{color:#157546}
@media (max-width: 1080px){.dashboard-monitor-split{grid-template-columns:1fr}.dashboard-bubble-metric-list{grid-template-columns:repeat(3,minmax(0,1fr));}}
@media (max-width: 640px){.dashboard-bubble-metric-list{grid-template-columns:1fr}.dashboard-user-bubble{padding:16px}}

/* dashboard statistic tables */
.dashboard-shell{gap:24px}
.dashboard-monitor-layout{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:22px}
.dashboard-monitor-panel{padding:24px;border-radius:24px;background:linear-gradient(180deg,#fff 0%,#f8fbff 100%);box-shadow:0 16px 36px rgba(30,79,157,.08)}
.dashboard-stat-table-wrap{overflow:auto;border-radius:20px;border:1px solid #dbe8ff;background:#fff}
.dashboard-stat-table{width:100%;border-collapse:separate;border-spacing:0;min-width:680px}
.dashboard-stat-table thead th{padding:15px 16px;background:#f4f8ff;color:#20406b;font-size:.78rem;font-weight:800;text-transform:uppercase;letter-spacing:.04em;border-bottom:1px solid #dbe8ff;text-align:left}
.dashboard-stat-table tbody td{padding:16px;border-bottom:1px solid #edf3ff;color:#1f3556;font-size:.95rem;vertical-align:middle}
.dashboard-stat-table tbody tr:last-child td{border-bottom:0}
.dashboard-stat-table tbody tr:hover td{background:#fbfdff}
.dashboard-user-inline{display:flex;align-items:center;gap:12px;min-width:180px}
.dashboard-user-dot{width:12px;height:12px;border-radius:999px;background:#2f6fed;box-shadow:0 0 0 6px rgba(47,111,237,.10)}
.dashboard-user-dot-wa{background:#12a150;box-shadow:0 0 0 6px rgba(18,161,80,.10)}
.dashboard-table-progress{display:grid;gap:8px;min-width:140px}
.dashboard-table-progress span{font-size:.84rem;font-weight:700;color:#57759e}
.dashboard-table-progress .progress-bar{height:10px}
@media (max-width:1100px){.dashboard-monitor-layout{grid-template-columns:1fr}}
@media (max-width:640px){.dashboard-monitor-panel{padding:18px}.dashboard-stat-table thead th,.dashboard-stat-table tbody td{padding:13px 12px}}


.dashboard-monitor-layout-single{grid-template-columns:1fr;gap:24px}.compact-panel-header{padding-bottom:6px}.compact-panel-header .panel-subtitle{display:none}.dashboard-monitor-card-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:18px}.dashboard-monitor-card{border:1px solid #dfe9f8;border-radius:22px;background:linear-gradient(180deg,#ffffff 0%,#f7fbff 100%);padding:18px 18px 16px;box-shadow:0 12px 28px rgba(28,79,157,.08)}.dashboard-monitor-card-wa{background:linear-gradient(180deg,#ffffff 0%,#f5fffb 100%)}.dashboard-monitor-card-head{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:14px}.dashboard-monitor-card-head h3{margin:0;font-size:1.02rem;color:#183a6a}.dashboard-monitor-rate{display:inline-flex;align-items:center;justify-content:center;padding:6px 10px;border-radius:999px;background:#eaf2ff;color:#1c61da;font-weight:800;font-size:.84rem}.dashboard-monitor-rate-wa{background:#e9fbf1;color:#118a51}.dashboard-monitor-metrics{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px}.dashboard-monitor-metric{padding:12px;border-radius:16px;background:#f8fbff;border:1px solid #e8f0fc}.dashboard-monitor-card-wa .dashboard-monitor-metric{background:#f8fffb;border-color:#e2f4ea}.dashboard-monitor-metric span{display:block;font-size:.75rem;color:#6f86a8;line-height:1.3;margin-bottom:7px}.dashboard-monitor-metric strong{display:block;font-size:1.1rem;color:#17365f}.dashboard-monitor-progress{height:10px;border-radius:999px;background:#e8f0fb;margin-top:16px;overflow:hidden}.dashboard-monitor-progress-wa{background:#e4f5ec}@media (max-width:1180px){.dashboard-monitor-card-grid{grid-template-columns:repeat(2,minmax(0,1fr));}}@media (max-width:720px){.dashboard-monitor-card-grid{grid-template-columns:1fr}.dashboard-monitor-metrics{grid-template-columns:1fr}.dashboard-monitor-card{padding:16px}}

.dashboard-filter-panel{padding:14px 18px;}
.dashboard-period-filter{display:flex;flex-wrap:wrap;gap:10px;}
.period-chip{border:1px solid #d8e4f8;background:#fff;color:#2457b8;border-radius:999px;padding:10px 16px;font-weight:700;cursor:pointer;}
.period-chip.is-active{background:#1f6fff;color:#fff;border-color:#1f6fff;}

.dashboard-filter-form{align-items:end;}
.dashboard-chip-row{display:flex;gap:10px;flex-wrap:wrap;margin-top:12px;}
.dashboard-activity-list{display:grid;gap:12px;}
.dashboard-activity-item{padding:14px 16px;border:1px solid #e3ebf9;border-radius:16px;background:#fff;}


/* v5.12 responsive dashboard and navigation refinements */
body{overflow-x:hidden}
img{max-width:100%;height:auto}
.sidebar{scrollbar-width:thin}
.sidebar-toggle-button{min-width:44px;min-height:44px;font-size:1.15rem}
.brand-logo-image{width:52px;height:52px;object-fit:contain;border-radius:16px;background:#fff;border:1px solid var(--line);padding:6px;box-shadow:var(--shadow-sm)}
.topbar{position:sticky;top:0;z-index:900;padding:0 0 12px;margin-bottom:20px;background:linear-gradient(180deg,rgba(244,248,255,.94) 0%,rgba(244,248,255,.86) 72%,rgba(244,248,255,0) 100%);backdrop-filter:blur(10px)}
.topbar-left{min-width:0}
.topbar-left>div{min-width:0}
.topbar h1{word-break:break-word}
.topbar-actions .pill{display:inline-flex;align-items:center;justify-content:center;min-height:44px}
.main-panel{min-width:0}
.section-grid,.dashboard-shell{min-width:0}
.panel,.stat-card,.dashboard-monitor-panel,.dashboard-activity-item{min-width:0}
.dashboard-filter-panel{padding:18px 20px}
.dashboard-filter-form{grid-template-columns:repeat(12,minmax(0,1fr));gap:14px}
.dashboard-filter-form .field{min-width:0}
.dashboard-filter-form input,.dashboard-filter-form select{width:100%}
.dashboard-period-value{font-size:clamp(1rem,1.8vw,1.2rem)!important;line-height:1.35;word-break:break-word}
.dashboard-chip-row .badge{max-width:100%;white-space:normal}
.dashboard-stat-table-wrap{-webkit-overflow-scrolling:touch}
.dashboard-stat-table td,.dashboard-stat-table th{white-space:nowrap}
.dashboard-activity-item{display:grid;gap:6px}
.page-footer{padding-bottom:max(18px,env(safe-area-inset-bottom))}

@media (max-width: 980px){
  .app-shell{grid-template-columns:1fr}
  .sidebar{padding:20px 16px 24px;padding-top:max(20px,env(safe-area-inset-top));padding-bottom:max(24px,env(safe-area-inset-bottom))}
  .main-panel{padding:18px 14px 22px}
  .topbar{align-items:stretch;gap:12px}
  .topbar-left,.topbar-actions{width:100%}
  .topbar-actions{justify-content:stretch}
  .topbar-actions .pill{flex:1 1 220px}
  .dashboard-filter-form{grid-template-columns:repeat(6,minmax(0,1fr))}
  .dashboard-filter-form .form-col-3{grid-column:span 3}
  .dashboard-filter-form .form-col-2{grid-column:span 2}
  .dashboard-filter-form .form-col-1{grid-column:span 1}
}

@media (max-width: 760px){
  .brand-box{padding:14px}
  .brand-title{font-size:1rem}
  .nav-link,.nav-link-button{padding:12px 14px}
  .topbar{padding-bottom:10px;margin-bottom:16px}
  .topbar h1{font-size:clamp(1.35rem,6vw,1.72rem)}
  .topbar-actions{gap:8px}
  .topbar-actions .pill{width:100%;flex:1 1 100%}
  .dashboard-filter-panel{padding:16px}
  .dashboard-filter-form{grid-template-columns:1fr 1fr}
  .dashboard-filter-form .form-col-3,.dashboard-filter-form .form-col-2,.dashboard-filter-form .form-col-1{grid-column:span 1}
  .filter-submit-wrap{display:flex;align-items:flex-end}
  .filter-submit-wrap .button{width:100%}
  .dashboard-chip-row{gap:8px}
  .stats-grid,.dashboard-stats-grid,.stats-grid-four{grid-template-columns:1fr !important}
  .stat-card{padding:18px 16px;border-radius:18px}
  .stat-value{font-size:clamp(1.5rem,7vw,2rem)}
  .dashboard-monitor-layout{grid-template-columns:1fr}
  .dashboard-stat-table{min-width:0}
  .dashboard-stat-table thead{display:none}
  .dashboard-stat-table,.dashboard-stat-table tbody,.dashboard-stat-table tr,.dashboard-stat-table td{display:block;width:100%}
  .dashboard-stat-table tbody{display:grid;gap:12px;padding:12px}
  .dashboard-stat-table tr{border:1px solid #dbe8ff;border-radius:18px;background:linear-gradient(180deg,#ffffff 0%,#f9fbff 100%);padding:4px 0;overflow:hidden;box-shadow:0 8px 18px rgba(37,88,184,.06)}
  .dashboard-stat-table td{display:flex;justify-content:space-between;gap:14px;align-items:flex-start;padding:12px 14px;border-bottom:1px solid #edf3ff;white-space:normal}
  .dashboard-stat-table td:last-child{border-bottom:0}
  .dashboard-stat-table td::before{content:attr(data-label);font-size:.74rem;font-weight:800;letter-spacing:.03em;text-transform:uppercase;color:#6e86a8;flex:0 0 86px}
  .dashboard-user-inline{min-width:0;gap:10px}
  .dashboard-table-progress{width:100%;min-width:0}
  .dashboard-table-progress span{text-align:right}
}

@media (max-width: 520px){
  .main-panel{padding:16px 12px 20px}
  .sidebar{width:min(88vw,320px)}
  .brand-mark,.brand-logo-image{width:46px;height:46px}
  .topbar-left{gap:10px}
  .sidebar-toggle-button{padding:0 12px}
  .dashboard-filter-form{grid-template-columns:1fr}
  .dashboard-filter-form .form-col-3,.dashboard-filter-form .form-col-2,.dashboard-filter-form .form-col-1{grid-column:span 1}
  .dashboard-stat-table tbody{padding:10px}
  .dashboard-stat-table td{flex-direction:column;gap:8px}
  .dashboard-stat-table td::before{flex-basis:auto}
}

/* v5.13 modern responsive refresh */
:root {
    --glass: rgba(255, 255, 255, 0.72);
    --glass-strong: rgba(255, 255, 255, 0.88);
    --accent-2: #6fa8ff;
    --accent-3: #8fb8ff;
}

body {
    background:
        radial-gradient(circle at 0% 0%, rgba(47, 111, 237, 0.18), transparent 30%),
        radial-gradient(circle at 100% 0%, rgba(111, 168, 255, 0.22), transparent 28%),
        linear-gradient(180deg, #f8fbff 0%, #edf4ff 55%, #e8f1ff 100%);
}

.sidebar,
.panel,
.stat-card,
.dashboard-monitor-panel,
.modal-card,
.topbar .pill,
.sidebar-card {
    backdrop-filter: blur(14px);
}

.sidebar {
    background: linear-gradient(180deg, rgba(255,255,255,.92) 0%, rgba(246,250,255,.9) 100%);
}

.brand-box,
.sidebar-card,
.panel,
.stat-card,
.dashboard-monitor-panel,
.modal-card {
    border-color: rgba(191, 214, 248, 0.92);
    box-shadow: 0 18px 42px rgba(30, 79, 157, 0.08);
}

.topbar {
    padding-bottom: 16px;
    margin-bottom: 24px;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.topbar h1 {
    margin: 0;
    font-size: clamp(1.6rem, 2.5vw, 2.1rem);
    font-weight: 800;
    letter-spacing: -0.02em;
}

.topbar-actions {
    gap: 10px;
}

.topbar-actions .pill {
    background: linear-gradient(180deg, rgba(255,255,255,.86) 0%, rgba(240,246,255,.92) 100%);
    border: 1px solid rgba(191, 214, 248, 0.92);
    box-shadow: 0 10px 28px rgba(30, 79, 157, 0.08);
}

.nav-link,
.nav-link-button,
.button,
.button-secondary,
.button-danger,
.button-success {
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease, background .18s ease;
}

.nav-link:hover,
.nav-link.active,
.nav-link-button:hover,
.button:hover,
.button-secondary:hover,
.button-danger:hover,
.button-success:hover {
    box-shadow: 0 10px 24px rgba(30, 79, 157, 0.14);
}

.panel,
.dashboard-monitor-panel,
.modal-card {
    background: linear-gradient(180deg, var(--glass-strong) 0%, rgba(248, 251, 255, 0.92) 100%);
}

.panel-header,
.database-toolbar {
    gap: 14px;
}

.database-toolbar-actions,
.button-group,
.action-row {
    row-gap: 10px;
}

.filter-bar,
.dashboard-filter-panel {
    background: linear-gradient(180deg, rgba(255,255,255,.62) 0%, rgba(243,248,255,.8) 100%);
    border: 1px solid rgba(211, 227, 252, 0.95);
    border-radius: 22px;
}

.field label {
    font-weight: 700;
    color: #24456f;
}

input,
select,
textarea {
    min-height: 46px;
    border-radius: 14px;
    border: 1px solid #cfe0fb;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.85);
}

textarea {
    min-height: 120px;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: #7aa9ff;
    box-shadow: 0 0 0 4px rgba(47, 111, 237, 0.12);
}

.table-responsive,
.dashboard-stat-table-wrap {
    border-radius: 22px;
    border: 1px solid rgba(211, 227, 252, 0.95);
    background: rgba(255,255,255,.88);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.9);
}

.table thead th,
.dashboard-stat-table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
}

.table tbody tr,
.dashboard-stat-table tbody tr {
    transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}

.table tbody tr:hover,
.dashboard-stat-table tbody tr:hover {
    transform: translateY(-1px);
}

.table td,
.table th {
    vertical-align: middle;
}

.database-actions-cell,
.action-row,
.button-group,
.database-toolbar-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.dashboard-stats-grid .stat-card {
    background:
        radial-gradient(circle at top right, rgba(255,255,255,.62), transparent 34%),
        linear-gradient(180deg, rgba(255,255,255,.96) 0%, rgba(244,248,255,.94) 100%);
    border: 1px solid rgba(196, 217, 248, 0.92);
}

.stat-icon-badge {
    box-shadow: 0 12px 24px rgba(47, 111, 237, 0.14);
}

.stat-value {
    letter-spacing: -0.03em;
}

.dashboard-activity-item {
    background: linear-gradient(180deg, rgba(255,255,255,.98) 0%, rgba(246,250,255,.92) 100%);
    border-radius: 18px;
    box-shadow: 0 10px 22px rgba(30, 79, 157, 0.06);
}

.followup-list-clean,
.empty-state,
.sync-indicator-row,
.database-chip-row,
.dashboard-chip-row {
    min-width: 0;
}

.modal-dialog {
    width: min(96vw, 760px);
}

.modal-card {
    border-radius: 26px;
}

@media (max-width: 980px) {
    .sidebar {
        width: min(86vw, 340px);
        border-radius: 0 24px 24px 0;
    }

    .database-toolbar,
    .panel-header,
    .topbar,
    .topbar-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .database-toolbar-actions .button,
    .button-group .button,
    .action-row .button {
        flex: 1 1 220px;
    }

    .filter-bar,
    .dashboard-filter-panel,
    .panel,
    .dashboard-monitor-panel {
        border-radius: 20px;
    }
}

@media (max-width: 760px) {
    .sidebar-card,
    .brand-box,
    .panel,
    .stat-card,
    .dashboard-monitor-panel,
    .modal-card {
        border-radius: 18px;
    }

    .database-toolbar-actions,
    .button-group,
    .action-row,
    .database-actions-cell {
        flex-direction: column;
        align-items: stretch;
    }

    .database-toolbar-actions .button,
    .button-group .button,
    .action-row .button,
    .database-actions-cell .button,
    .database-actions-cell form,
    .database-actions-cell .inline-form {
        width: 100%;
    }

    .table-stack-mobile td[data-label]::before {
        min-width: 92px;
    }

    .sync-indicator-row {
        display: grid;
        grid-template-columns: 1fr;
    }
}

@media (max-width: 520px) {
    .topbar {
        padding-bottom: 12px;
        margin-bottom: 18px;
    }

    .topbar h1 {
        font-size: clamp(1.35rem, 6vw, 1.7rem);
    }

    .filter-bar,
    .dashboard-filter-panel {
        padding: 14px;
    }

    .table-stack-mobile td,
    .dashboard-stat-table td {
        padding-left: 12px;
        padding-right: 12px;
    }
}

/* v5.13 dashboard statistik upgrade */
.dashboard-insight-grid{display:grid;grid-template-columns:minmax(0,1.4fr) minmax(280px,.9fr);gap:22px}
.dashboard-insight-grid-outcome{grid-template-columns:repeat(2,minmax(0,1fr))}
.dashboard-chart-panel,.dashboard-mini-insights,.dashboard-outcome-panel{padding:24px;border-radius:24px;background:linear-gradient(180deg,#ffffff 0%,#f8fbff 100%);box-shadow:0 16px 38px rgba(30,79,157,.08)}
.dashboard-trend-chart{display:grid;grid-template-columns:repeat(auto-fit,minmax(28px,1fr));gap:12px;align-items:end;min-height:260px;padding:18px 2px 0}
.trend-group{display:grid;gap:10px;align-items:end;justify-items:center;min-width:0}
.trend-bars{height:210px;width:100%;display:flex;align-items:flex-end;justify-content:center;gap:6px;padding:0 2px}
.trend-bar{width:min(18px,42%);min-height:6px;border-radius:12px 12px 4px 4px;background:linear-gradient(180deg,#d9e7ff 0%,#2f6fed 100%);box-shadow:0 10px 18px rgba(47,111,237,.18)}
.trend-bar-wa{background:linear-gradient(180deg,#d8f6e3 0%,#11a151 100%);box-shadow:0 10px 18px rgba(17,161,81,.18)}
.trend-label{font-size:.74rem;color:#6f86a8;text-align:center;white-space:nowrap}
.dashboard-legend-row{display:flex;gap:16px;flex-wrap:wrap;margin-top:16px}
.dashboard-legend-item{display:inline-flex;align-items:center;gap:8px;font-size:.84rem;color:#567191;font-weight:700}
.dashboard-legend-dot{width:10px;height:10px;border-radius:999px;display:inline-block}
.dashboard-legend-dot-phone{background:#2f6fed}
.dashboard-legend-dot-wa{background:#11a151}
.dashboard-kpi-stack{display:grid;gap:14px}
.dashboard-kpi-item{display:grid;gap:4px;padding:16px 18px;border-radius:18px;border:1px solid #dfebff;background:#fff}
.dashboard-kpi-item span{font-size:.78rem;color:#748dad;text-transform:uppercase;letter-spacing:.04em;font-weight:800}
.dashboard-kpi-item strong{font-size:1.35rem;color:#163f97;line-height:1.2}
.dashboard-kpi-item small{color:#6c83a3;line-height:1.45}
.dashboard-kpi-highlight{background:linear-gradient(135deg,#1f6fff 0%,#76a9ff 100%);border-color:transparent}
.dashboard-kpi-highlight span,.dashboard-kpi-highlight strong,.dashboard-kpi-highlight small{color:#fff}
.dashboard-outcome-list{display:grid;gap:14px}
.dashboard-outcome-item{display:grid;gap:8px}
.dashboard-outcome-head{display:flex;align-items:center;justify-content:space-between;gap:12px;font-size:.92rem;color:#21416f}
.dashboard-outcome-head strong{font-size:.98rem;color:#163f97}
.dashboard-outcome-track{height:12px;border-radius:999px;background:#e8f0fb;overflow:hidden}
.dashboard-outcome-fill{height:100%;border-radius:999px;background:linear-gradient(90deg,#2f6fed 0%,#89b6ff 100%)}
.dashboard-outcome-fill-wa{background:linear-gradient(90deg,#11a151 0%,#83d9a6 100%)}
.dashboard-user-table-wrapper{overflow:auto;border-radius:20px;border:1px solid #dbe8ff;background:#fff}
.dashboard-user-table{width:100%;border-collapse:separate;border-spacing:0;min-width:640px}
.dashboard-user-table thead th{padding:15px 16px;background:#f4f8ff;color:#20406b;font-size:.78rem;font-weight:800;text-transform:uppercase;letter-spacing:.04em;border-bottom:1px solid #dbe8ff;text-align:left}
.dashboard-user-table tbody td{padding:16px;border-bottom:1px solid #edf3ff;color:#1f3556;font-size:.95rem;vertical-align:middle}
.dashboard-user-table tbody tr:last-child td{border-bottom:0}
.dashboard-user-table tbody tr:hover td{background:#fbfdff}
@media (max-width:1200px){.dashboard-insight-grid{grid-template-columns:1fr}.dashboard-insight-grid-outcome{grid-template-columns:1fr}.dashboard-trend-chart{grid-template-columns:repeat(auto-fit,minmax(24px,1fr));gap:10px}}
@media (max-width:760px){.dashboard-chart-panel,.dashboard-mini-insights,.dashboard-outcome-panel{padding:18px}.dashboard-trend-chart{min-height:220px;overflow-x:auto;padding-bottom:8px}.trend-bars{height:180px}.dashboard-user-table{min-width:0}.dashboard-user-table thead{display:none}.dashboard-user-table tbody,.dashboard-user-table tr,.dashboard-user-table td{display:block;width:100%}.dashboard-user-table tbody tr{padding:14px;border-bottom:1px solid #edf3ff}.dashboard-user-table tbody td{border:0;padding:8px 0}.dashboard-user-table td[data-label]{display:flex;justify-content:space-between;gap:16px;align-items:flex-start}.dashboard-user-table td[data-label]::before{content:attr(data-label);font-size:.78rem;font-weight:800;color:#6d86a8;text-transform:uppercase;letter-spacing:.04em;flex:0 0 100px}.dashboard-table-progress{min-width:0;width:100%}}
@media (max-width:520px){.dashboard-insight-grid,.dashboard-insight-grid-outcome,.dashboard-monitor-layout{gap:16px}.dashboard-kpi-item{padding:14px 15px}.dashboard-trend-chart{grid-template-columns:repeat(12,minmax(22px,1fr));overflow-x:auto}.trend-label{font-size:.68rem}.dashboard-user-table td[data-label]::before{flex-basis:86px}}

.wa-countdown-badge{margin-top:8px;color:var(--warning-dark,#8a5a00);font-weight:600;}
.button.is-waiting{opacity:.8;cursor:wait;}
.sensitive-view.copy-protection-active,.sensitive-view.copy-protection-active *{user-select:none;-webkit-user-select:none;}


/* v1.5.10 dashboard and anti fraud filter polish */
.dashboard-filter-form-wide{grid-template-columns:repeat(12,minmax(0,1fr));gap:14px}
.dashboard-filter-form-wide .form-col-4{grid-column:span 4}
.dashboard-filter-form-wide .form-col-3{grid-column:span 3}
.dashboard-filter-form-wide .form-col-2{grid-column:span 2}
.anti-fraud-filter-form{grid-template-columns:repeat(12,minmax(0,1fr));gap:16px;align-items:end}
.anti-fraud-filter-form .field{min-width:0}
.anti-fraud-filter-form .form-col-4{grid-column:span 4}
.anti-fraud-filter-form .form-col-3{grid-column:span 3}
.anti-fraud-filter-form .form-col-2{grid-column:span 2}
.anti-fraud-filter-form .form-col-12{grid-column:1 / -1}
.anti-fraud-filter-form select,.anti-fraud-filter-form input{min-height:46px}
.anti-fraud-filter-form .filter-submit-wrap{display:flex;gap:10px;flex-wrap:wrap;align-items:flex-end}
.anti-fraud-filter-form .filter-submit-wrap .button{min-width:140px}
@media (max-width: 980px){
  .anti-fraud-filter-form,.dashboard-filter-form-wide{grid-template-columns:repeat(6,minmax(0,1fr))}
  .anti-fraud-filter-form .form-col-4{grid-column:span 3}
  .anti-fraud-filter-form .form-col-3{grid-column:span 2}
  .anti-fraud-filter-form .form-col-2{grid-column:span 1}
  .dashboard-filter-form-wide .form-col-4{grid-column:span 3}
  .dashboard-filter-form-wide .form-col-3{grid-column:span 2}
  .dashboard-filter-form-wide .form-col-2{grid-column:span 1}
}
@media (max-width: 760px){
  .anti-fraud-filter-form,.dashboard-filter-form-wide{grid-template-columns:1fr 1fr}
  .anti-fraud-filter-form .form-col-4,.anti-fraud-filter-form .form-col-3,.anti-fraud-filter-form .form-col-2,.dashboard-filter-form-wide .form-col-4,.dashboard-filter-form-wide .form-col-3,.dashboard-filter-form-wide .form-col-2{grid-column:span 1}
  .anti-fraud-filter-form .filter-submit-wrap{display:grid;grid-template-columns:1fr 1fr}
  .anti-fraud-filter-form .filter-submit-wrap .button{width:100%;min-width:0}
}
@media (max-width: 520px){
  .anti-fraud-filter-form,.dashboard-filter-form-wide{grid-template-columns:1fr}
  .anti-fraud-filter-form .form-col-4,.anti-fraud-filter-form .form-col-3,.anti-fraud-filter-form .form-col-2,.dashboard-filter-form-wide .form-col-4,.dashboard-filter-form-wide .form-col-3,.dashboard-filter-form-wide .form-col-2{grid-column:span 1}
  .anti-fraud-filter-form .filter-submit-wrap{grid-template-columns:1fr}
}


/* anti fraud filter layout fix */
.anti-fraud-filter-form-spacious{grid-template-columns:repeat(12,minmax(0,1fr));gap:18px;align-items:end}
.anti-fraud-filter-form-spacious .anti-fraud-period-field,
.anti-fraud-filter-form-spacious .anti-fraud-date-field{grid-column:span 4}
.anti-fraud-filter-form-spacious label{display:block;margin-bottom:8px;font-size:14px;line-height:1.4;white-space:normal}
.anti-fraud-filter-form-spacious select,
.anti-fraud-filter-form-spacious input{width:100%;min-height:48px;font-size:14px;padding:12px 14px}
.anti-fraud-filter-form-spacious .filter-submit-wrap{display:flex;gap:12px;flex-wrap:wrap;margin-top:2px}
@media (max-width: 980px){
  .anti-fraud-filter-form-spacious{grid-template-columns:1fr 1fr}
  .anti-fraud-filter-form-spacious .anti-fraud-period-field,
  .anti-fraud-filter-form-spacious .anti-fraud-date-field{grid-column:span 1}
}
@media (max-width: 640px){
  .anti-fraud-filter-form-spacious{grid-template-columns:1fr}
}


/* v1.5.12 anti fraud filter spacing */
.anti-fraud-filter-form-spacious .anti-fraud-user-field{grid-column:span 6}
.anti-fraud-filter-form-spacious .anti-fraud-period-field{grid-column:span 2}
.anti-fraud-filter-form-spacious .anti-fraud-date-field{grid-column:span 2}
.anti-fraud-filter-form-spacious label{font-size:15px;margin-bottom:10px}
.anti-fraud-filter-form-spacious select,.anti-fraud-filter-form-spacious input{font-size:15px;min-height:50px;padding:12px 14px}
@media (max-width: 980px){
  .anti-fraud-filter-form-spacious .anti-fraud-user-field{grid-column:1 / -1}
  .anti-fraud-filter-form-spacious .anti-fraud-period-field,.anti-fraud-filter-form-spacious .anti-fraud-date-field{grid-column:span 1}
}
