:root {
    --font-family-base: "Inter", "Segoe UI", Roboto, Arial, sans-serif;

    --color-bg: #f3f6fb;
    --color-surface: #ffffff;
    --color-surface-muted: #f8fafd;
    --color-text: #1f2937;
    --color-text-muted: #6b7280;
    --color-border: #d9e1ea;

    --color-primary: #2563eb;
    --color-primary-hover: #1d4ed8;
    --color-secondary: #4b5563;
    --color-secondary-hover: #374151;

    --color-success-bg: #e8f8ee;
    --color-success-border: #b6e3c1;
    --color-success-text: #1f6b33;

    --color-error-bg: #fff1f1;
    --color-error-border: #f0b7b7;
    --color-error-text: #8a1f1f;

    --color-warning-bg: #fff8e6;
    --color-warning-border: #f2d48a;
    --color-warning-text: #8a6500;

    --color-info-bg: #e9f3ff;
    --color-info-border: #bad6fb;
    --color-info-text: #0f3f91;

    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-7: 28px;
    --space-8: 32px;

    --radius-sm: 8px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-pill: 999px;

    --shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.05);
    --shadow-md: 0 12px 32px rgba(15, 23, 42, 0.08);

    --focus-ring: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: var(--space-6);
    font-family: var(--font-family-base);
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.45;
}

.container {
    max-width: 900px;
    margin: var(--space-2) auto;
    background: var(--color-surface);
    padding: var(--space-7);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
}

.container-sm {
    max-width: 480px;
}

.container-xl {
    max-width: 1400px;
}

h1,
h2,
h3 {
    margin-top: 0;
    margin-bottom: var(--space-3);
}

.subtitle {
    color: var(--color-text-muted);
    margin-bottom: var(--space-5);
}

.input-group {
    margin-bottom: var(--space-4);
}

.input-group.no-margin {
    margin-bottom: 0;
}

label {
    display: block;
    margin-bottom: var(--space-2);
    font-weight: 600;
}

input[type="text"],
input[type="password"],
textarea,
select {
    width: 100%;
    padding: 14px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: 15px;
    color: var(--color-text);
    background: var(--color-surface);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:focus-visible,
textarea:focus-visible,
select:focus-visible,
button:focus-visible,
.btn:focus-visible {
    border-color: var(--color-primary);
    box-shadow: var(--focus-ring);
    outline: none;
}

button,
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: 12px 18px;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    background: var(--color-primary);
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background-color 0.15s ease, transform 0.08s ease, box-shadow 0.15s ease;
}

button:hover,
.btn:hover {
    background: var(--color-primary-hover);
}

button:active,
.btn:active {
    transform: translateY(1px);
}

button:disabled,
.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-secondary {
    background: var(--color-secondary);
}

.btn-secondary:hover {
    background: var(--color-secondary-hover);
}

.actions {
    display: flex;
    gap: var(--space-3);
    flex-wrap: wrap;
    margin-top: var(--space-4);
}

.actions.no-margin {
    margin-top: 0;
}

.status-box,
.result-box,
.message-box,
.card {
    margin-top: var(--space-5);
    padding: var(--space-4);
    border-radius: var(--radius-md);
    background: var(--color-surface-muted);
    border: 1px solid #e4e8ee;
}

.message-error {
    background: var(--color-error-bg);
    border-color: var(--color-error-border);
    color: var(--color-error-text);
}

.message-success {
    background: var(--color-success-bg);
    border-color: var(--color-success-border);
    color: var(--color-success-text);
}

.message-warning {
    background: var(--color-warning-bg);
    border-color: var(--color-warning-border);
    color: var(--color-warning-text);
}


button:focus-visible,
.btn:focus-visible {
    outline: 2px solid #0f3f91;
    outline-offset: 2px;
}

.alert {
    display: block;
    border-left: 4px solid transparent;
}

.alert::before {
    display: inline-block;
    margin-right: var(--space-2);
    font-weight: 700;
}

.alert-success {
    background: var(--color-success-bg);
    border-color: var(--color-success-border);
    border-left-color: #238a44;
    color: var(--color-success-text);
}

.alert-success::before {
    content: "Sucesso:";
}

.alert-error {
    background: var(--color-error-bg);
    border-color: var(--color-error-border);
    border-left-color: #b42318;
    color: var(--color-error-text);
}

.alert-error::before {
    content: "Erro:";
}

.alert-warning {
    background: var(--color-warning-bg);
    border-color: var(--color-warning-border);
    border-left-color: #b7791f;
    color: var(--color-warning-text);
}

.alert-warning::before {
    content: "Atenção:";
}

.alert-info {
    background: var(--color-info-bg);
    border-color: var(--color-info-border);
    border-left-color: #1d4ed8;
    color: var(--color-info-text);
}

.alert-info::before {
    content: "Informação:";
}

.alert-loading {
    background: #eef3ff;
    border-color: #c7d6fb;
    border-left-color: #4f46e5;
    color: #1e3a8a;
}

.alert-loading::before {
    content: "Carregando:";
}

.is-hidden {
    display: none;
}

.result-box a,
.table-link {
    word-break: break-all;
}

.table-link--truncate {
    display: inline-block;
    max-width: 280px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: bottom;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-4);
    flex-wrap: wrap;
}

.filters-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(160px, 1fr)) auto;
    gap: var(--space-3);
    align-items: end;
}

.filters-card {
    border: 1px solid #d8e3f2;
    background: #f7faff;
}

.filters-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: var(--space-3);
}

.pagination-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-3);
    flex-wrap: wrap;
}

.table-wrapper {
    overflow-x: auto;
    margin-top: var(--space-5);
    -webkit-overflow-scrolling: touch;
}

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

th,
td {
    padding: 12px;
    border-bottom: 1px solid #e6e9ef;
    text-align: left;
    vertical-align: top;
}

th {
    background: #f2f6fb;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    color: #46556b;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: var(--radius-pill);
    font-size: 12px;
    font-weight: 700;
    background: #e8eef9;
    color: #204a87;
}


.badge.status-info,
.badge.status-processing {
    background: #eaf2ff;
    color: #2457a7;
}

.badge.status-warning {
    background: #fff4d6;
    color: #8a6500;
}

.badge.status-success {
    background: #e6f7ea;
    color: #237a3b;
}

.badge.status-danger {
    background: #fdeaea;
    color: #a12b2b;
}

.badge.status-muted {
    background: #f1f5f9;
    color: #334155;
}

.badge.status-paid {
    background: #dff7e8;
    color: #0f5f2f;
}

.badge.aguardando_verificacao {
    background: #eaf2ff;
    color: #2457a7;
}

.badge.compra_confirmada {
    background: #e6f7ea;
    color: #237a3b;
}

.badge.compra_nao_confirmada,
.badge.erro {
    background: #fdeaea;
    color: #a12b2b;
}

.badge.cashback_pago {
    background: #ebfff2;
    color: #117a3d;
}

.badge.platform-badge.mercadolivre {
    background: #fff3cf;
    color: #8a6500;
}

.badge.platform-badge.shopee {
    background: #ffe8e1;
    color: #a63c12;
}

.badge.platform-badge.nao_informado {
    background: #f1f5f9;
    color: #334155;
}

.status-help {
    display: block;
    margin-top: 6px;
    font-size: 12px;
    color: var(--color-text-muted);
    max-width: 240px;
}

.cashback-highlight {
    font-weight: 700;
    color: #117a3d;
}

.empty-state {
    padding: var(--space-4);
    border: 1px dashed #c9d4e3;
    border-radius: var(--radius-md);
    background: #f8fbff;
}

.empty-state p {
    margin: var(--space-2) 0 0;
    color: var(--color-text-muted);
}

.row-warning {
    background: #fff7f7;
}

.row-neutral {
    background: #fffdf2;
}

.row-needs-action {
    background: #fff9e7;
}

.row-needs-action td:first-child {
    border-left: 4px solid #f59e0b;
}

.row-ready-payment {
    background: #eef7ff;
}

.row-ready-payment td:first-child {
    border-left: 4px solid #2563eb;
}

.row-completed {
    background: #f3fcf5;
    opacity: 0.92;
}

.row-completed td:first-child {
    border-left: 4px solid #16a34a;
}

.small {
    font-size: 13px;
    color: var(--color-text-muted);
}

.history-summary {
    margin-top: var(--space-5);
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: var(--space-3);
}

.summary-card {
    border: 1px solid #e4e8ee;
    border-radius: var(--radius-md);
    background: var(--color-surface-muted);
    box-shadow: var(--shadow-sm);
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.summary-label {
    color: var(--color-text-muted);
    font-size: 13px;
}

.summary-card strong {
    font-size: 20px;
    color: var(--color-text);
}

.summary-value {
    font-size: 14px;
    color: #1f5fbf;
    font-weight: 700;
}

.history-list {
    margin-top: var(--space-5);
    display: grid;
    gap: var(--space-3);
}

.history-card {
    position: relative;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-md);
    background: #fbfdff;
    padding: var(--space-4);
    box-shadow: var(--shadow-sm);
    padding-right: 108px;
}

.history-card p {
    margin: 0 0 var(--space-2);
}

.history-card p:last-child {
    margin-bottom: 0;
}

.history-card-desc {
    font-weight: 600;
    color: #1e293b;
}

.history-card-image {
    position: absolute;
    top: var(--space-4);
    right: var(--space-4);
    width: 72px;
    height: 72px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    border: 1px solid #d8e3f2;
    background: #f1f5f9;
}

.col-status {
    min-width: 180px;
}

.col-value {
    min-width: 120px;
}

.col-notes {
    min-width: 200px;
}

.status-badge {
    margin-bottom: 8px;
}

.status-help-alert {
    color: #9a6700;
    font-weight: 600;
}

.field-compact {
    padding: 8px 10px !important;
    font-size: 13px !important;
}

.field-money {
    border-color: #cfe3ff;
}

.field-percent {
    border-color: #dbe9d0;
}

.admin-link-actions {
    justify-content: center;
    align-items: center;
    flex-direction: column;
    gap: var(--space-2);
    min-width: 170px;
}

.admin-link-actions button {
    width: 100%;
}

.history-controls {
    margin-top: var(--space-5);
}

.history-search-group {
    margin-bottom: var(--space-3);
}

.history-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
}

.history-tab {
    width: auto;
    padding: 9px 12px;
    font-size: 13px;
    background: #eaf1ff;
    color: #1e3a8a;
}

.history-tab.is-active {
    background: var(--color-primary);
    color: #fff;
}

.status-legend {
    margin-top: var(--space-3);
    font-size: 14px;
}

.status-legend summary {
    cursor: pointer;
    font-weight: 600;
    color: #334155;
}

.status-legend ul {
    margin: var(--space-2) 0 0;
    padding-left: 18px;
    color: var(--color-text-muted);
}

.history-card-actions .btn {
    width: auto;
}

@media (max-width: 768px) {
    body {
        padding: var(--space-4);
    }

    .container {
        padding: var(--space-5);
    }

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

    .actions {
        width: 100%;
    }

    .actions > * {
        flex: 1 1 auto;
    }

    button,
    .btn {
        width: 100%;
    }

    .topbar {
        align-items: stretch;
    }

    .pagination-bar {
        flex-direction: column;
        align-items: flex-start;
    }

    table {
        min-width: 100%;
        border-collapse: separate;
        border-spacing: 0 var(--space-3);
    }

    thead {
        display: none;
    }

    tbody tr {
        display: block;
        background: #fbfdff;
        border: 1px solid #e6ebf3;
        border-radius: var(--radius-md);
        padding: 2px var(--space-3);
    }

    tbody td {
        display: block;
        border: 0;
        padding: 10px 0;
    }

    tbody td::before {
        content: attr(data-label);
        display: block;
        font-size: 12px;
        font-weight: 700;
        color: #5c6d85;
        text-transform: uppercase;
        letter-spacing: 0.03em;
        margin-bottom: 4px;
    }

    .table-link--truncate {
        max-width: 100%;
    }

    .history-card {
        padding-right: var(--space-4);
        padding-top: 96px;
    }

    .history-card-image {
        left: var(--space-4);
        right: auto;
    }

    .history-tabs .history-tab {
        flex: 1 1 calc(50% - var(--space-2));
    }
}

.stepper {
    list-style: none;
    padding: 0;
    margin: 0 0 var(--space-5) 0;
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-2);
}

.stepper-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: 10px 12px;
    border: 1px solid #e4e8ee;
    border-radius: var(--radius-md);
    background: #f9fbff;
    color: #334155;
    font-weight: 600;
    font-size: 14px;
}

.stepper-item span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: var(--radius-pill);
    background: #dbe7ff;
    color: #1e40af;
    font-size: 13px;
    font-weight: 700;
}

.stepper-item.is-active {
    border-color: #b8cdfc;
    background: #edf3ff;
}

.result-help {
    margin: var(--space-3) 0;
    color: var(--color-text-muted);
}

.result-link {
    display: block;
    max-width: 100%;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.result-box .result-link {
    word-break: normal;
}

.result-actions {
    margin-top: var(--space-4);
}

@media (min-width: 768px) {
    .stepper {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.users-filter-form {
    margin: 16px 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 12px;
    align-items: end;
}

.users-filter-form .filter-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.users-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 10px;
    margin-bottom: 16px;
}

.summary-card {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface-muted);
    padding: 10px 12px;
}

.summary-card span {
    display: block;
    font-size: 12px;
    color: var(--color-text-muted);
}

.summary-card strong {
    font-size: 20px;
}

.email-warning {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.email-warning small {
    color: var(--color-warning-text);
    font-size: 12px;
}


.robot-status-card{display:flex;flex-direction:column;gap:10px}.robot-status-header{display:flex;gap:10px;align-items:flex-start}.robot-status-indicator{width:12px;height:12px;border-radius:999px;display:inline-block;margin-top:8px}.robot-status-ok{background:var(--color-success-bg);border:1px solid var(--color-success-border);color:var(--color-success-text)}.robot-status-warning{background:var(--color-warning-bg);border:1px solid var(--color-warning-border);color:var(--color-warning-text)}.robot-status-danger{background:var(--color-error-bg);border:1px solid var(--color-error-border);color:var(--color-error-text)}.robot-status-muted{background:#f3f4f6;border:1px solid #d1d5db;color:#374151}.robot-status-running{background:var(--color-info-bg);border:1px solid var(--color-info-border);color:var(--color-info-text)}.robot-next-action{font-weight:600;margin:0}.robot-technical-details summary{cursor:pointer}.robot-log-item{padding:8px 0;border-top:1px dashed #d9e1ea}.robot-log-item:first-child{border-top:0}@media (max-width:768px){.robot-status-header{flex-direction:row}.robot-status-card .actions button{width:100%}}
