:root {
    --bg: #6f84d8;
    --surface: #ffffff;
    --surface-soft: #f8fafc;
    --ink: #0f172a;
    --muted: #667085;
    --line: #e3e8f2;
    --brand: #0d6efd;
    --brand-dark: #0958cc;
    --green: #22c55e;
    --yellow: #f59e0b;
    --red: #ff453a;
    --nav: #6f84d8;
    --nav-soft: rgba(255, 255, 255, .18);
    --shadow: 0 18px 45px rgba(23, 35, 84, .13);
    --soft-shadow: 0 8px 24px rgba(23, 35, 84, .08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--bg);
    color: var(--ink);
}

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

button {
    cursor: pointer;
}

.login-page {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 430px;
    gap: 24px;
    align-items: center;
    width: min(1040px, calc(100% - 40px));
    min-height: 100vh;
    margin: 0 auto;
}

.login-showcase {
    position: relative;
    overflow: hidden;
    min-height: 560px;
    padding: 36px;
    border-radius: 28px;
    background: linear-gradient(145deg, #0d47a1 0%, #0d6efd 56%, #2f7af0 100%);
    color: #fff;
    box-shadow: 0 30px 70px rgba(15, 23, 42, .24);
}

.login-showcase::after {
    content: "";
    position: absolute;
    inset: auto -80px -110px auto;
    width: 320px;
    height: 320px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .12);
}

.login-brand {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 12px;
}

.login-brand small {
    display: block;
    color: #bfdbfe;
}

.showcase-copy {
    position: relative;
    z-index: 1;
    max-width: 620px;
    margin-top: 92px;
}

.showcase-copy span {
    display: inline-flex;
    margin-bottom: 14px;
    padding: 8px 12px;
    border: 1px solid rgba(255, 255, 255, .18);
    border-radius: 999px;
    background: rgba(255, 255, 255, .1);
    color: #dbeafe;
    font-weight: 900;
}

.showcase-copy h1 {
    margin: 0 0 18px;
    font-size: clamp(34px, 5vw, 58px);
    line-height: 1.03;
}

.showcase-copy p {
    margin: 0;
    color: #dbeafe;
    font-size: 18px;
    line-height: 1.6;
}

.login-card {
    padding: 34px;
    border: 1px solid rgba(217, 225, 238, .95);
    border-radius: 24px;
    background: #fff;
    box-shadow: 0 24px 70px rgba(15, 23, 42, .14);
}

.login-card-head {
    margin-bottom: 24px;
}

.login-card h2 {
    margin: 0 0 6px;
    font-size: 34px;
}

.login-card-head span,
.login-foot {
    color: var(--muted);
    line-height: 1.45;
}

.login-foot {
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
    font-size: 13px;
}

.shell {
    display: grid;
    grid-template-columns: 236px 1fr;
    min-height: 100vh;
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 28px 20px;
    background: transparent;
    color: #fff;
    box-shadow: none;
}

.brand {
    display: flex;
    align-items: center;
    gap: 11px;
    margin-bottom: 32px;
}

.brand-mark {
    display: grid;
    width: 42px;
    height: 42px;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, .34);
    border-radius: 10px;
    background: linear-gradient(145deg, #073b9f, #0d6efd);
    box-shadow: 0 10px 24px rgba(7, 59, 159, .26);
}

.brand-mark svg {
    width: 30px;
    height: 30px;
    display: block;
}

.brand-mark .logo-ring,
.brand-mark .logo-arrow {
    fill: none;
    stroke: #ffffff;
    stroke-width: 4.2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.brand-mark .logo-dot {
    fill: #22c55e;
    stroke: #fff;
    stroke-width: 1.3;
}

.brand small,
.profile-box small {
    display: block;
    color: rgba(255, 255, 255, .78);
    margin-top: 2px;
}

.nav {
    display: grid;
    gap: 7px;
    margin-bottom: 28px;
}

.nav a {
    color: #fff;
    text-decoration: none;
    padding: 12px 13px;
    border-radius: 12px;
    font-weight: 700;
    transition: background .18s ease, color .18s ease, transform .18s ease;
}

.nav a.active,
.nav a:hover {
    background: rgba(255, 255, 255, .20);
    color: #fff;
    transform: translateX(2px);
}

.profile-box {
    display: grid;
    gap: 8px;
    margin-top: auto;
    padding: 16px;
    border: 1px solid rgba(255, 255, 255, .25);
    border-radius: 14px;
    background: rgba(255, 255, 255, .12);
}

.profile-box span {
    color: #dbe7ff;
    font-size: 12px;
    font-weight: 900;
}

.sidebar-btn {
    width: 100%;
    margin-top: 8px;
    border: 1px solid rgba(255, 255, 255, .16);
    border-radius: 10px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, .18);
    color: #fff;
    font-weight: 800;
}

.content {
    min-width: 0;
    min-height: calc(100vh - 40px);
    margin: 20px 22px 20px 0;
    padding: 24px;
    border-radius: 22px;
    background: #fff;
    box-shadow: 0 20px 50px rgba(23, 35, 84, .18);
}

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

.hero-top {
    padding: 0 0 22px;
    border: 0;
    border-bottom: 1px solid var(--line);
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
}

.topbar h1,
.panel h2 {
    margin: 0;
}

.topbar h1 {
    font-size: 30px;
    line-height: 1.18;
}

.topbar p:not(.eyebrow) {
    max-width: 680px;
    margin: 9px 0 0;
    color: var(--muted);
    line-height: 1.5;
}

.eyebrow {
    margin: 0 0 6px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 0;
    text-transform: uppercase;
}

.status-pill,
.badge {
    flex: 0 0 auto;
    padding: 9px 12px;
    border-radius: 999px;
    background: #eef4ff;
    color: var(--brand-dark);
    font-weight: 800;
}

.status-pill.ok {
    background: #dcfce7;
    color: #047857;
}

.status-pill.error {
    background: #fee2e2;
    color: var(--red);
}

.notice {
    margin-bottom: 18px;
    padding: 13px 15px;
    border-radius: 12px;
    background: #e8f0ff;
    color: var(--brand-dark);
    font-weight: 800;
}

.notice.error {
    background: #fee2e2;
    color: var(--red);
}

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

.admin-grid {
    margin-bottom: 18px;
}

.span-4 {
    grid-column: span 4;
}

.span-5 {
    grid-column: span 5;
}

.span-7 {
    grid-column: span 7;
}

.span-12 {
    grid-column: span 12;
}

.panel {
    min-width: 0;
    padding: 20px;
    border: 1px solid #dfe5ee;
    border-radius: 14px;
    background: #fff;
    box-shadow: none;
    backdrop-filter: none;
}

.campaign-card {
    background: #fff;
}

.compact-panel {
    min-height: 178px;
}

.panel-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
}

.field,
.stack-form {
    display: grid;
    gap: 8px;
}

.field {
    margin-bottom: 14px;
}

.field span,
.switch span {
    color: #344054;
    font-weight: 800;
}

.field small {
    color: var(--muted);
    font-size: 12px;
    line-height: 1.4;
}

input,
textarea,
select {
    width: 100%;
    border: 1px solid #dce4f0;
    border-radius: 12px;
    padding: 13px 14px;
    color: var(--ink);
    background: #fff;
    outline: none;
}

textarea {
    resize: vertical;
    line-height: 1.5;
}

input:focus,
textarea:focus,
select:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, .12);
}

.primary-btn,
.ghost-btn,
.primary-icon,
.remove-phone,
.chip {
    border: 0;
    border-radius: 12px;
    font-weight: 900;
}

.primary-btn {
    padding: 13px 16px;
    color: #fff;
    background: #0d6efd;
    box-shadow: none;
}

.primary-btn:hover {
    background: #0b5ed7;
}

.ghost-btn,
.chip {
    padding: 10px 12px;
    color: var(--brand-dark);
    background: #edf5ff;
}

.primary-icon {
    width: 42px;
    height: 42px;
    color: #fff;
    background: #0d6efd;
    font-size: 24px;
    line-height: 1;
}

.full {
    width: 100%;
}

.token-row,
.switch-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}

.switch {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.switch input {
    width: 18px;
    height: 18px;
    margin-top: 2px;
    accent-color: var(--brand);
}

.phone-list {
    display: grid;
    gap: 10px;
    margin-bottom: 14px;
}

.phone-row {
    display: grid;
    grid-template-columns: 1fr 40px;
    gap: 8px;
}

.remove-phone {
    color: var(--red);
    background: #fee2e2;
}

.hint {
    margin: 12px 0 0;
    color: var(--muted);
    line-height: 1.45;
}

.metric {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin: 8px 0 18px;
}

.metric span {
    font-size: 46px;
    font-weight: 950;
}

.metric small {
    color: var(--muted);
}

.progress-track {
    height: 12px;
    overflow: hidden;
    border-radius: 999px;
    background: #e5eaf3;
}

#progressBar {
    width: 0;
    height: 100%;
    background: linear-gradient(90deg, var(--brand), var(--green));
    transition: width .25s ease;
}

.log {
    display: grid;
    gap: 8px;
    max-height: 280px;
    overflow: auto;
    margin-top: 16px;
}

.log-line {
    padding: 10px 12px;
    border-radius: 12px;
    background: var(--surface-soft);
    color: #344054;
}

.log-line.success {
    background: #dcfce7;
    color: #047857;
}

.log-line.error {
    background: #fee2e2;
    color: var(--red);
}

.log-line.warn {
    background: #fef3c7;
    color: #92400e;
}

.table-list {
    display: grid;
    gap: 10px;
    margin-top: 16px;
}

.table-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface-soft);
}

.table-row small {
    display: block;
    margin-top: 3px;
    color: var(--muted);
}

.empty-state {
    padding: 26px;
    border: 1px dashed var(--line);
    border-radius: 14px;
    color: var(--muted);
    text-align: center;
}

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

.user-table {
    display: grid;
    gap: 10px;
    margin-top: 18px;
}

.user-row {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) auto auto auto;
    gap: 12px;
    align-items: center;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface-soft);
}

.user-row small {
    display: block;
    margin-top: 3px;
    color: var(--muted);
}

.row-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.inline-form {
    margin: 0;
}

.danger-btn {
    border: 0;
    border-radius: 12px;
    padding: 10px 12px;
    background: #fee2e2;
    color: var(--red);
    font-weight: 900;
}

.ok-badge {
    background: #dcfce7;
    color: #047857;
}

.off-badge {
    background: #f1f5f9;
    color: #64748b;
}

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

.user-edit-card {
    display: grid;
    gap: 10px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--surface-soft);
}

.user-edit-card .field {
    margin-bottom: 0;
}

.user-active {
    padding: 5px 0;
}

.user-meta {
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}

.form-divider {
    margin-top: 6px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    align-items: end;
    margin-top: 16px;
}

.settings-grid .field {
    margin-bottom: 0;
}

.evolution-settings {
    align-items: start;
}

.evolution-settings .primary-btn {
    align-self: end;
}

.user-maintenance-form {
    grid-template-columns: 1.1fr 1.1fr .9fr auto;
}

.form-actions {
    display: grid;
    gap: 8px;
}

.company-edit-card {
    display: grid;
    gap: 12px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fff;
}

.company-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.company-title small {
    display: block;
    margin-top: 3px;
    color: var(--muted);
}

.company-settings {
    grid-template-columns: 1.3fr .9fr 1fr auto .9fr;
    margin-top: 0;
}

.evolution-status-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-top: 16px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--surface-soft);
}

.evolution-status-card small {
    display: block;
    margin-top: 4px;
    color: var(--muted);
}

.evolution-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.qr-box {
    display: grid;
    justify-items: start;
    margin-top: 14px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: #fff;
}

.qr-box img {
    width: min(260px, 100%);
    height: auto;
    border-radius: 12px;
}

.qr-box pre {
    max-width: 100%;
    overflow: auto;
    white-space: pre-wrap;
    color: var(--ink);
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(15, 23, 42, .56);
}

.modal-backdrop[hidden] {
    display: none;
}

.modal-card {
    width: min(520px, 100%);
    padding: 22px;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 28px 80px rgba(15, 23, 42, .28);
}

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

.modal-head h2 {
    margin: 0;
}

.icon-close {
    width: 38px;
    height: 38px;
    border: 0;
    border-radius: 12px;
    background: #f1f5f9;
    color: var(--ink);
    font-weight: 900;
}

.sending input,
.sending textarea {
    pointer-events: none;
}

@media (max-width: 1040px) {
    .login-page,
    .shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
        height: auto;
    }

    .content {
        margin: 0;
        border-radius: 0;
        min-height: auto;
    }

    .span-4,
    .span-5,
    .span-7,
    .span-12 {
        grid-column: span 12;
    }
}

@media (max-width: 680px) {
    .content,
    .login-card,
    .login-showcase {
        padding: 22px;
    }

    .login-page {
        width: min(100% - 24px, 1120px);
        gap: 16px;
        padding: 18px 0;
    }

    .login-showcase {
        min-height: 440px;
    }

    .showcase-copy {
        margin-top: 54px;
    }

    .topbar,
    .panel-heading,
    .table-row,
    .company-title,
    .evolution-status-card {
        align-items: stretch;
        flex-direction: column;
    }

    .settings-grid,
    .company-settings {
        grid-template-columns: 1fr;
    }

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

    .row-actions {
        justify-content: stretch;
    }

    .row-actions > * {
        flex: 1;
    }

    .topbar h1 {
        font-size: 25px;
    }
}
