:root {
    --bg: #f3f6fb;
    --surface: #ffffff;
    --surface-soft: #f8fafc;
    --text: #152033;
    --muted: #6f7b8e;
    --line: #e5eaf1;
    --primary: #6758e8;
    --primary-dark: #4d3fd2;
    --sidebar: #11192a;
    --success: #1fa971;
    --danger: #cc3f55;
    --warning: #c38619;
    --shadow: 0 14px 38px rgba(25, 38, 64, .08);
}

* {
    box-sizing: border-box;
}

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

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

button, input {
    font: inherit;
}

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

.sidebar {
    background: var(--sidebar);
    color: #fff;
    min-height: 100vh;
    padding: 28px 20px 20px;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
}

.brand-mark {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    color: #fff;
    font-size: 28px;
    font-weight: 900;
    font-style: italic;
    background: linear-gradient(135deg, #7667f4, #4d3fd2);
    box-shadow: 0 9px 25px rgba(103, 88, 232, .36);
}

.brand strong,
.brand small {
    display: block;
    line-height: 1;
}

.brand strong {
    font-size: 19px;
    letter-spacing: .05em;
}

.brand small {
    font-size: 12px;
    color: #aeb7ca;
    margin-top: 5px;
    letter-spacing: .08em;
}

.menu {
    display: grid;
    gap: 8px;
    margin-top: 52px;
}

.menu a {
    padding: 13px 14px;
    border-radius: 12px;
    color: #b8c1d3;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: .2s ease;
}

.menu a:hover,
.menu a.active {
    color: #fff;
    background: rgba(255, 255, 255, .09);
}

.menu a.active {
    box-shadow: inset 3px 0 0 #887af8;
}

.sidebar-user {
    margin-top: auto;
    padding-top: 20px;
    border-top: 1px solid rgba(255,255,255,.1);
    display: grid;
    grid-template-columns: 40px 1fr 24px;
    gap: 10px;
    align-items: center;
}

.avatar {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: #6758e8;
    font-weight: 800;
}

.sidebar-user strong,
.sidebar-user small {
    display: block;
}

.sidebar-user strong {
    font-size: 13px;
}

.sidebar-user small {
    color: #8f9ab0;
    font-size: 11px;
    margin-top: 3px;
}

.logout {
    color: #9ba6ba;
    font-size: 21px;
}

.content {
    padding: 38px;
    min-width: 0;
}

.page-header {
    display: flex;
    justify-content: space-between;
    gap: 24px;
    align-items: flex-start;
    margin-bottom: 30px;
}

h1, h2, h3, p {
    margin-top: 0;
}

h1 {
    font-size: 31px;
    margin-bottom: 7px;
}

h2 {
    font-size: 22px;
    margin-bottom: 7px;
}

.eyebrow {
    color: var(--primary);
    font-size: 11px;
    font-weight: 850;
    letter-spacing: .16em;
    margin-bottom: 9px;
}

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

.status-pill {
    padding: 9px 13px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 999px;
    font-size: 12px;
    color: var(--muted);
    box-shadow: 0 6px 20px rgba(25, 38, 64, .04);
}

.status-pill span {
    display: inline-block;
    width: 8px;
    height: 8px;
    margin-right: 7px;
    border-radius: 50%;
    background: var(--success);
}

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

.metric-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 17px;
    padding: 22px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: var(--shadow);
}

.metric-icon,
.service-icon {
    width: 46px;
    height: 46px;
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    border-radius: 13px;
    background: #eeebff;
    color: var(--primary);
    font-weight: 900;
    font-size: 21px;
}

.metric-card strong {
    font-size: 27px;
}

.metric-card p {
    color: var(--muted);
    font-size: 13px;
    margin: 2px 0 0;
}

.section-heading {
    margin: 35px 0 17px;
    display: flex;
    justify-content: space-between;
    align-items: end;
}

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

.service-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 22px;
    box-shadow: var(--shadow);
    min-height: 245px;
    display: flex;
    flex-direction: column;
}

.service-card-link {
    transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}

.service-card-link:hover {
    transform: translateY(-4px);
    border-color: #cfc8ff;
    box-shadow: 0 19px 44px rgba(25, 38, 64, .13);
}

.service-card-link:hover .service-action {
    background: #e8e4ff;
}

.service-top {
    display: flex;
    justify-content: space-between;
    align-items: start;
}

.tag {
    color: var(--success);
    background: #eaf8f2;
    border-radius: 999px;
    padding: 5px 9px;
    font-size: 10px;
    font-weight: 800;
}

.service-company-count {
    color: var(--primary-dark);
    background: #eeebff;
    border-radius: 999px;
    padding: 6px 10px;
    font-size: 10px;
    font-weight: 850;
}

.service-card h3 {
    margin: 20px 0 8px;
}

.service-card p {
    color: var(--muted);
    font-size: 13px;
    line-height: 1.55;
}

.service-card button {
    margin-top: auto;
    width: 100%;
    border: 0;
    border-radius: 11px;
    padding: 11px;
    background: var(--surface-soft);
    color: #9aa4b5;
}

.flash-wrap {
    position: fixed;
    right: 24px;
    top: 22px;
    z-index: 30;
    display: grid;
    gap: 8px;
}

.flash {
    min-width: 280px;
    padding: 13px 15px;
    border-radius: 12px;
    color: #fff;
    box-shadow: var(--shadow);
}

.flash.success { background: var(--success); }
.flash.danger { background: var(--danger); }
.flash.warning { background: var(--warning); }

.login-page {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1.05fr .95fr;
    background: #fff;
}

.login-presentation {
    position: relative;
    overflow: hidden;
    color: #fff;
    background:
        radial-gradient(circle at 15% 20%, rgba(132, 116, 255, .44), transparent 30%),
        radial-gradient(circle at 85% 80%, rgba(43, 191, 200, .22), transparent 30%),
        linear-gradient(145deg, #11192a, #1c2850 65%, #2b2367);
    padding: 70px;
    display: flex;
    align-items: center;
}

.login-presentation::after {
    content: "";
    position: absolute;
    width: 330px;
    height: 330px;
    right: -100px;
    bottom: -100px;
    border: 1px solid rgba(255,255,255,.14);
    border-radius: 50%;
    box-shadow:
        0 0 0 50px rgba(255,255,255,.025),
        0 0 0 100px rgba(255,255,255,.018);
}

.presentation-content {
    position: relative;
    z-index: 1;
    max-width: 570px;
}

.brand-login {
    margin-bottom: 82px;
}

.presentation-content h1 {
    font-size: clamp(38px, 5vw, 66px);
    line-height: 1.04;
    letter-spacing: -.04em;
    margin-bottom: 24px;
}

.login-copy {
    color: #bdc6d8;
    font-size: 17px;
    line-height: 1.7;
    max-width: 510px;
}

.login-form-area {
    display: grid;
    place-items: center;
    padding: 40px;
}

.login-card {
    width: min(410px, 100%);
}

.login-card h2 {
    font-size: 32px;
    margin-bottom: 7px;
}

.login-card > .muted {
    margin-bottom: 35px;
}

.login-card label:not(.check-row) {
    display: block;
    font-size: 13px;
    font-weight: 750;
    margin: 18px 0 8px;
}

.login-card input[type="email"],
.login-card input[type="password"] {
    width: 100%;
    padding: 14px 15px;
    border: 1px solid #dce2eb;
    border-radius: 11px;
    outline: none;
    background: #fbfcfe;
}

.login-card input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(103, 88, 232, .1);
}

.check-row {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    font-size: 13px;
    margin: 17px 0 22px;
}

.login-card button {
    width: 100%;
    border: 0;
    color: #fff;
    background: var(--primary);
    padding: 14px;
    border-radius: 11px;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 10px 25px rgba(103, 88, 232, .25);
}

.login-card button:hover {
    background: var(--primary-dark);
}

.empty-state {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 60px 30px;
    text-align: center;
    box-shadow: var(--shadow);
}

.empty-icon {
    width: 64px;
    height: 64px;
    display: grid;
    place-items: center;
    margin: 0 auto 18px;
    border-radius: 18px;
    background: #eeebff;
    color: var(--primary);
    font-size: 28px;
}

.empty-state p {
    color: var(--muted);
}

.empty-state a {
    display: inline-block;
    color: #fff;
    background: var(--primary);
    border-radius: 10px;
    padding: 11px 15px;
    margin-top: 8px;
    font-weight: 750;
}

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

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

    .sidebar {
        min-height: auto;
        height: auto;
        position: static;
        padding: 18px;
    }

    .menu {
        grid-template-columns: repeat(4, 1fr);
        overflow-x: auto;
        margin-top: 22px;
    }

    .menu a {
        min-width: 120px;
        justify-content: center;
    }

    .sidebar-user {
        margin-top: 20px;
    }

    .content {
        padding: 24px 18px;
    }

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

    .login-presentation {
        min-height: 390px;
        padding: 38px 26px;
    }

    .brand-login {
        margin-bottom: 55px;
    }

    .login-form-area {
        padding: 45px 24px;
    }
}

@media (max-width: 560px) {
    .metrics,
    .services-grid {
        grid-template-columns: 1fr;
    }

    .page-header {
        display: block;
    }

    .status-pill {
        display: inline-block;
        margin-top: 15px;
    }

    .menu {
        grid-template-columns: repeat(2, 1fr);
    }
}

.primary-link {
    display: inline-block;
    margin-top: 18px;
    padding: 12px 16px;
    border-radius: 10px;
    color: #fff;
    background: var(--primary);
    font-weight: 800;
}
/* ===== V2: empresas e painel do cliente ===== */
.button {
    border: 1px solid transparent;
    border-radius: 11px;
    padding: 11px 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: 750;
    cursor: pointer;
    transition: .2s ease;
    white-space: nowrap;
}

.button.primary { background: var(--primary); color: #fff; box-shadow: 0 9px 22px rgba(103,88,232,.2); }
.button.primary:hover { background: var(--primary-dark); }
.button.secondary { background: var(--sidebar); color: #fff; }
.button.ghost { background: var(--surface); border-color: var(--line); color: var(--text); }
.button.danger-outline { background: #fff; border-color: #f1cbd2; color: var(--danger); }
.button.success-outline { background: #fff; border-color: #bfe6d6; color: var(--success); }
.full-button { width: 100%; }
.text-link, .card-title-row a, .inline-empty a { color: var(--primary); font-weight: 750; font-size: 13px; }

.logout-form { margin: 0; }
.logout { border: 0; background: none; cursor: pointer; padding: 0; }

.panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 18px;
    box-shadow: var(--shadow);
}

.filter-panel { padding: 18px; margin-bottom: 18px; }
.filters {
    display: grid;
    grid-template-columns: minmax(240px, 1fr) minmax(180px, 220px) minmax(150px, 180px) auto auto;
    align-items: end;
    gap: 12px;
    min-width: 0;
}
.field { min-width: 0; }
.field.grow { min-width: 240px; }
.field.compact, .field.service-filter { width: auto; }
.field label { display: block; font-size: 12px; font-weight: 750; margin-bottom: 7px; color: #49556a; white-space: nowrap; }
.field input, .field select, .field textarea {
    width: 100%;
    border: 1px solid #dce2eb;
    border-radius: 10px;
    padding: 12px 13px;
    background: #fbfcfe;
    color: var(--text);
    outline: none;
}
.field textarea {
    resize: vertical;
    min-height: 145px;
    line-height: 1.55;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(103,88,232,.1); }
.filter-button { height: 43px; }

.active-filter-summary {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 7px;
    margin: -3px 0 16px;
    color: var(--muted);
    font-size: 12px;
}

.active-filter-summary strong {
    color: var(--primary-dark);
    background: #eeebff;
    border-radius: 999px;
    padding: 6px 10px;
}

.active-filter-summary .result-count {
    color: #4f5c72;
}

.active-filter-summary a {
    margin-left: auto;
    color: var(--primary);
    font-weight: 750;
}

.table-panel { overflow: hidden; }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-gutter: stable; }
.data-table { width: 100%; border-collapse: collapse; min-width: 930px; }
.data-table th { text-align: left; padding: 14px 18px; background: var(--surface-soft); color: #7d8798; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; }
.data-table td { padding: 17px 18px; border-top: 1px solid var(--line); vertical-align: middle; font-size: 13px; }
.data-table td > span, .data-table td > small, .data-table td > a { display: block; }
.data-table td small { color: var(--muted); margin-top: 5px; }
.company-name { font-weight: 800; font-size: 14px; }
.company-name:hover { color: var(--primary); }
.actions-cell { text-align: right; }
.icon-button { width: 34px; height: 34px; display: inline-grid !important; place-items: center; border: 1px solid var(--line); border-radius: 10px; color: var(--primary); font-weight: 800; }

.badge { display: inline-flex !important; width: fit-content; border-radius: 999px; padding: 5px 9px; font-size: 10px; font-weight: 850; }
.badge.success { color: #17835b; background: #e9f8f1; }
.badge.danger { color: #b5354a; background: #fdecef; }
.badge.warning { color: #9b6813; background: #fff5df; }
.badge.neutral { color: #647086; background: #edf1f6; }
.mini-tags { display: flex; flex-wrap: wrap; gap: 5px; max-width: 230px; }
.mini-tags span { padding: 4px 7px; border-radius: 7px; background: #eeebff; color: var(--primary-dark); font-size: 10px; font-weight: 750; }
.mini-tags small { margin: 0 !important; }

.compact-empty { box-shadow: none; border: 0; }
.company-form { display: grid; gap: 18px; }
.form-section { padding: 26px; }
.section-title { display: flex; align-items: flex-start; gap: 13px; padding-bottom: 22px; margin-bottom: 23px; border-bottom: 1px solid var(--line); }
.section-title h2 { margin-bottom: 4px; }
.section-title p { color: var(--muted); font-size: 13px; margin: 0; }
.step-number { width: 31px; height: 31px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 9px; background: #eeebff; color: var(--primary); font-weight: 900; }
.form-grid { display: grid; gap: 18px; }
.form-grid.two-columns { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.full-width { grid-column: 1 / -1; }

.switch-row { margin-top: 23px; display: flex; align-items: center; gap: 12px; cursor: pointer; }
.switch-row input { position: absolute; opacity: 0; pointer-events: none; }
.switch { position: relative; width: 43px; height: 24px; flex: 0 0 auto; border-radius: 999px; background: #cbd2de; transition: .2s; }
.switch::after { content: ''; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px; border-radius: 50%; background: #fff; box-shadow: 0 2px 5px rgba(0,0,0,.15); transition: .2s; }
.switch-row input:checked + .switch { background: var(--success); }
.switch-row input:checked + .switch::after { transform: translateX(19px); }
.switch-row strong, .switch-row small { display: block; }
.switch-row strong { font-size: 13px; }
.switch-row small { color: var(--muted); margin-top: 2px; font-size: 11px; }
.compact-switch { margin: 17px 0; }

.service-check-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 13px; }
.service-check-card { position: relative; border: 1px solid var(--line); border-radius: 15px; padding: 18px; cursor: pointer; min-height: 190px; display: flex; flex-direction: column; transition: .2s; }
.service-check-card input { position: absolute; opacity: 0; }
.service-check-card .check-visual { position: absolute; right: 13px; top: 13px; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; border: 1px solid #dce2eb; color: transparent; font-size: 12px; }
.service-check-card strong { margin-top: 16px; font-size: 14px; }
.service-check-card small { color: var(--muted); line-height: 1.45; margin-top: 7px; font-size: 11px; }
.service-check-card:has(input:checked) { border-color: var(--primary); background: #faf9ff; box-shadow: 0 0 0 3px rgba(103,88,232,.08); }
.service-check-card input:checked ~ .check-visual { background: var(--primary); border-color: var(--primary); color: #fff; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; padding: 5px 0 20px; }

.company-header { align-items: center; }
.company-heading { display: flex; align-items: center; gap: 15px; }
.company-avatar { width: 53px; height: 53px; display: grid; place-items: center; border-radius: 15px; color: #fff; background: linear-gradient(135deg,#7162ef,#4b3dc8); font-weight: 900; font-size: 22px; }
.company-avatar.small { width: 39px; height: 39px; border-radius: 11px; font-size: 15px; }
.company-avatar.large { width: 64px; height: 64px; border-radius: 18px; font-size: 25px; }
.company-heading h1 { margin-bottom: 7px; }
.heading-badges { display: flex; gap: 6px; }
.header-actions { display: flex; gap: 9px; align-items: center; }
.header-actions form { margin: 0; }
.detail-layout { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(320px, .85fr); gap: 18px; align-items: start; }
.detail-main { display: grid; gap: 18px; }
.detail-card { padding: 24px; }
.card-title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; padding-bottom: 18px; border-bottom: 1px solid var(--line); margin-bottom: 20px; }
.card-title-row h2 { margin: 0; }
.info-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 22px; }
.info-grid div { min-width: 0; }
.info-grid small, .info-grid strong { display: block; }
.info-grid small { color: var(--muted); font-size: 11px; margin-bottom: 6px; }
.info-grid strong { font-size: 13px; overflow-wrap: anywhere; }
.enabled-services { display: grid; gap: 10px; }
.enabled-service { display: grid; grid-template-columns: 45px 1fr auto; gap: 12px; align-items: center; border: 1px solid var(--line); border-radius: 13px; padding: 13px; }
.enabled-service .service-icon { width: 42px; height: 42px; }
.enabled-service strong, .enabled-service small { display: block; }
.enabled-service small { color: var(--muted); font-size: 11px; margin-top: 4px; }
.inline-empty { text-align: center; padding: 22px; background: var(--surface-soft); border-radius: 13px; }
.inline-empty p { color: var(--muted); margin-bottom: 8px; }
.access-card h2 { margin-bottom: 8px; }
.access-card > .muted { font-size: 12px; line-height: 1.5; }
.access-form { display: grid; gap: 13px; margin-top: 20px; }
.access-status { border-top: 1px solid var(--line); margin-top: 20px; padding-top: 17px; display: flex; align-items: center; gap: 10px; }
.status-dot { width: 10px; height: 10px; border-radius: 50%; flex: 0 0 auto; }
.status-dot.online { background: var(--success); box-shadow: 0 0 0 4px rgba(31,169,113,.12); }
.status-dot.offline { background: var(--danger); box-shadow: 0 0 0 4px rgba(204,63,85,.12); }
.access-status strong, .access-status small { display: block; }
.access-status strong { font-size: 12px; }
.access-status small { color: var(--muted); margin-top: 3px; font-size: 10px; }

.dashboard-companies-heading { margin-top: 36px; }
.recent-companies { overflow: hidden; }
.recent-company-row { display: grid; grid-template-columns: 39px 1fr auto 20px; align-items: center; gap: 12px; padding: 14px 18px; border-top: 1px solid var(--line); }
.recent-company-row:first-child { border-top: 0; }
.recent-company-row:hover { background: var(--surface-soft); }
.recent-company-info strong, .recent-company-info small { display: block; }
.recent-company-info strong { font-size: 13px; }
.recent-company-info small { color: var(--muted); margin-top: 3px; font-size: 10px; }
.row-arrow { color: var(--primary); font-weight: 900; }
.dashboard-empty { border-radius: 0; }

.client-company-card { display: flex; align-items: center; gap: 17px; padding: 22px; color: #fff; border-radius: 19px; background: linear-gradient(135deg,#151e34,#312766); box-shadow: 0 18px 40px rgba(20,29,51,.18); }
.client-company-card small { color: #aeb7d1; font-size: 10px; letter-spacing: .12em; font-weight: 800; }
.client-company-card h2 { margin: 5px 0 5px; }
.client-company-card p { margin: 0; color: #bcc4d7; font-size: 12px; }
.client-services { grid-template-columns: repeat(3, minmax(0,1fr)); }
.standalone-error { margin: 80px auto; max-width: 600px; }

@media (max-width: 1280px) {
    .filters {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        align-items: end;
    }
    .filters .field.grow {
        grid-column: 1 / -1;
        min-width: 0;
    }
    .filter-button { width: 100%; }
}

@media (max-width: 1120px) {
    .service-check-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
    .detail-layout { grid-template-columns: 1fr; }
    .detail-side { order: -1; }
}

@media (max-width: 760px) {
    .filters { grid-template-columns: 1fr; align-items: stretch; }
    .filters .field.grow { grid-column: auto; }
    .field.compact, .field.service-filter { width: 100%; }
    .filter-button { width: 100%; }
    .active-filter-summary a { margin-left: 0; width: 100%; }
    .form-grid.two-columns, .info-grid { grid-template-columns: 1fr; }
    .service-check-grid { grid-template-columns: 1fr; }
    .company-header, .company-heading, .header-actions { align-items: flex-start; }
    .company-header { display: flex; }
    .header-actions { width: 100%; margin-top: 18px; }
    .header-actions form, .header-actions .button { flex: 1; }
    .header-actions .button { width: 100%; }
    .client-services { grid-template-columns: 1fr; }
}


/* ===== V3: PLANOS E CONTRATOS ===== */
.service-action {
    margin-top: auto;
    width: 100%;
    border-radius: 11px;
    padding: 11px;
    background: var(--surface-soft);
    color: var(--primary);
    text-align: center;
    font-size: 12px;
    font-weight: 800;
}
.service-action:hover { background: #eeebff; }
.plan-metrics { margin-bottom: 18px; }
.money-metric { font-size: 21px !important; white-space: nowrap; }
.plans-table { min-width: 1180px; }
.service-label { display: inline-flex !important; padding: 6px 9px; border-radius: 8px; background: #f1efff; color: var(--primary-dark); font-weight: 750; font-size: 11px; }
.row-actions { display: flex; justify-content: flex-end; gap: 7px; }
.row-actions form { margin: 0; }
.status-action { background: #fff; cursor: pointer; }
.status-action:hover { border-color: var(--primary); }
.field-help { display: block; color: var(--muted); font-size: 10px; line-height: 1.4; margin-top: 7px; }
.money-input { display: grid; grid-template-columns: 48px 1fr; border: 1px solid #dce2eb; border-radius: 10px; overflow: hidden; background: #fbfcfe; }
.money-input:focus-within { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(103,88,232,.1); }
.money-input span { display: grid; place-items: center; background: #f0f3f8; color: #677286; font-size: 12px; font-weight: 800; border-right: 1px solid #dce2eb; }
.money-input input { border: 0 !important; border-radius: 0 !important; box-shadow: none !important; }
.plan-explanation-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 12px; }
.plan-explanation { padding: 16px; display: flex; gap: 11px; align-items: flex-start; box-shadow: none; transition: .2s; }
.plan-explanation .service-icon { width: 38px; height: 38px; font-size: 17px; }
.plan-explanation strong, .plan-explanation small { display: block; }
.plan-explanation strong { font-size: 12px; margin-top: 2px; }
.plan-explanation small { color: var(--muted); font-size: 10px; line-height: 1.45; margin-top: 5px; }
.plan-explanation.selected { border-color: var(--primary); background: #faf9ff; box-shadow: 0 0 0 3px rgba(103,88,232,.07); }
.contract-grid { display: grid; gap: 17px; }
.contract-card { padding: 23px; }
.contract-card-header { display: grid; grid-template-columns: 47px 1fr auto; gap: 13px; align-items: center; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.contract-card-header .service-icon { width: 45px; height: 45px; }
.contract-card-header h2 { margin: 0; }
.contract-card-header .eyebrow { margin-bottom: 5px; }
.contract-fields { grid-template-columns: repeat(2, minmax(0,1fr)); margin-top: 20px; }
.contract-empty { margin-top: 18px; }
.card-title-actions { display: flex; align-items: center; gap: 12px; }
.button-mini { display: inline-flex; align-items: center; color: #fff !important; background: var(--primary); padding: 7px 10px; border-radius: 8px; font-size: 11px !important; }
.plan-enabled-service { grid-template-columns: 45px 1fr auto; }
.client-service-card { min-height: 315px; }
.client-plan-info { border: 1px solid var(--line); background: var(--surface-soft); border-radius: 11px; padding: 12px; margin: 6px 0 15px; }
.client-plan-info small, .client-plan-info strong, .client-plan-info span { display: block; }
.client-plan-info small { color: var(--muted); font-size: 9px; letter-spacing: .08em; font-weight: 800; }
.client-plan-info strong { margin-top: 4px; font-size: 13px; }
.client-plan-info span { color: var(--muted); margin-top: 4px; font-size: 10px; }
.client-plan-info.no-plan { border-style: dashed; }
.tag-warning { color: #9b6813; background: #fff5df; }
.tag-neutral { color: #647086; background: #edf1f6; }

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

@media (max-width: 760px) {
    .plan-explanation-grid, .contract-fields { grid-template-columns: 1fr; }
    .contract-card-header { grid-template-columns: 45px 1fr; }
    .contract-card-header > .badge { grid-column: 1 / -1; }
    .card-title-actions { align-items: flex-end; flex-direction: column; }
}

@media (max-width: 560px) {
    .plan-explanation-grid { grid-template-columns: 1fr; }
}


/* ===== V4.2: DESCRIÇÃO DOS PLANOS ===== */
.plan-description-cell {
    margin: 0;
    max-width: 280px;
    color: #556176;
    font-size: 11px;
    line-height: 1.45;
    white-space: pre-line;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.plan-rights-preview {
    margin-top: 10px;
    padding: 12px 13px;
    border: 1px solid #ded9ff;
    border-radius: 10px;
    background: #faf9ff;
}
.plan-rights-preview strong {
    display: block;
    color: var(--primary-dark);
    font-size: 10px;
    letter-spacing: .06em;
    text-transform: uppercase;
}
.plan-rights-preview p {
    margin: 7px 0 0;
    color: #4f5b70;
    font-size: 11px;
    line-height: 1.55;
    white-space: pre-line;
}
.plan-rights-preview.empty {
    border-style: dashed;
    background: var(--surface-soft);
}
.plan-rights-preview.empty strong,
.plan-rights-preview.empty p {
    color: var(--muted);
}
.client-plan-rights {
    margin-top: 11px;
    padding-top: 11px;
    border-top: 1px solid var(--line);
}
.client-plan-info .client-plan-rights small {
    color: var(--primary-dark);
}
.client-plan-info .client-plan-rights p {
    margin: 7px 0 0;
    color: #556176;
    font-size: 10px;
    line-height: 1.55;
    white-space: pre-line;
}


/* ===== V5: PAGAMENTOS E MENSALIDADES ===== */
.metric-card-link { transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease; }
.metric-card-link:hover { transform: translateY(-3px); border-color: #cec7ff; box-shadow: 0 18px 40px rgba(25,38,64,.13); }
.payment-header .header-actions { flex-wrap: wrap; }
.button.secondary { background: #fff; color: var(--primary-dark); border: 1px solid #d8d2ff; }
.button.secondary:hover { background: #f6f4ff; }
.success-button { background: var(--success); color: #fff; border: 0; }
.success-button:hover { filter: brightness(.95); }
.payment-metrics { margin-bottom: 18px; }
.danger-metric .metric-icon { color: var(--danger); background: #fff0f2; }
.payment-filters { grid-template-columns: minmax(240px, 1.4fr) minmax(170px, .75fr) minmax(145px, .65fr) minmax(165px, .7fr) auto auto; }
.month-filter { min-width: 165px; }
.payments-table { min-width: 1320px; }
.payments-table td { vertical-align: middle; }
.payments-table td > strong, .payments-table td > small { display: block; }
.payments-table td > small { color: var(--muted); font-size: 10px; margin-top: 4px; }
.payment-reference { display: block; max-width: 235px; color: #556176; font-size: 11px; line-height: 1.45; }
.payment-status { display: inline-flex; align-items: center; justify-content: center; min-width: 74px; padding: 6px 9px; border-radius: 999px; font-size: 10px; font-weight: 850; }
.payment-status.pendente { color: #7e631b; background: #fff6d9; }
.payment-status.vencido { color: #ad3044; background: #ffedf0; }
.payment-status.pago { color: #137c55; background: #e7f7f0; }
.payment-status.cancelado { color: #657086; background: #edf1f6; }
.payment-actions { min-width: 225px; flex-wrap: wrap; }
.mini-action { display: inline-flex; align-items: center; justify-content: center; min-height: 30px; padding: 6px 9px; border: 1px solid #dfe4ec; border-radius: 8px; background: #fff; color: #59657a; cursor: pointer; font-size: 10px; font-weight: 800; }
.mini-action:hover { border-color: var(--primary); color: var(--primary); }
.mini-action.receive { border-color: #bce7d5; color: #147d57; background: #effaf5; }
.mini-action.cancel { border-color: #f0ccd2; color: #b6374b; background: #fff7f8; }
.payment-form-card { max-width: 920px; }
.full-span { grid-column: 1 / -1; }
.payment-contract-preview { margin-top: 13px; padding: 14px 15px; border-radius: 12px; border: 1px solid #ddd8ff; background: #faf9ff; }
.payment-contract-preview strong, .payment-contract-preview p { display: block; }
.payment-contract-preview strong { font-size: 12px; }
.payment-contract-preview p { margin: 5px 0 0; color: var(--muted); font-size: 10px; line-height: 1.45; }
.receive-layout { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(340px, .75fr); gap: 18px; align-items: start; }
.payment-summary-card, .receive-form { padding: 25px; }
.payment-summary-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 18px; margin-top: 24px; }
.payment-summary-grid small, .payment-summary-grid strong { display: block; }
.payment-summary-grid small { color: var(--muted); font-size: 10px; margin-bottom: 5px; }
.payment-summary-grid strong { font-size: 13px; }
.payment-big-value { color: var(--primary-dark); font-size: 21px !important; }
.payment-reference-box { margin-top: 22px; padding: 15px; background: var(--surface-soft); border: 1px solid var(--line); border-radius: 12px; }
.payment-reference-box small { color: var(--muted); font-size: 9px; font-weight: 850; letter-spacing: .1em; }
.payment-reference-box p { margin: 7px 0 0; font-size: 12px; }
.receive-form h2 { margin-bottom: 22px; }
.receive-note { margin-top: 18px; padding: 12px 13px; color: #655a31; background: #fff9e7; border: 1px solid #f0dfaa; border-radius: 10px; font-size: 10px; line-height: 1.5; }
.company-payments-list { display: grid; }
.company-payment-row { display: grid; grid-template-columns: minmax(0,1fr) auto 82px; gap: 14px; align-items: center; padding: 13px 0; border-top: 1px solid var(--line); }
.company-payment-row:first-child { border-top: 0; }
.company-payment-row:hover strong { color: var(--primary-dark); }
.company-payment-row > div strong, .company-payment-row > div small { display: block; }
.company-payment-row > div strong { font-size: 12px; }
.company-payment-row > div small { margin-top: 4px; color: var(--muted); font-size: 10px; line-height: 1.4; }
.company-payment-row > span:not(.payment-status) { font-size: 12px; font-weight: 800; }

@media (max-width: 1400px) {
    .payment-filters { grid-template-columns: repeat(3, minmax(0,1fr)); }
    .payment-filters .field.grow { grid-column: 1 / -1; }
    .payment-filters .filter-button { width: 100%; }
}

@media (max-width: 1000px) {
    .receive-layout { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
    .payment-header .header-actions, .payment-header .header-actions form, .payment-header .header-actions .button { width: 100%; }
    .payment-filters { grid-template-columns: 1fr; }
    .payment-filters .field.grow { grid-column: auto; }
    .full-span { grid-column: auto; }
    .payment-summary-grid { grid-template-columns: 1fr; }
    .company-payment-row { grid-template-columns: minmax(0,1fr) auto; }
    .company-payment-row .payment-status { grid-column: 1 / -1; justify-self: start; }
}

/* v6 — Mercado Pago e boletos */
.integration-status-card {
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr) auto;
    align-items: center;
    gap: 14px;
    margin-bottom: 22px;
    padding: 16px 18px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.integration-status-card.ready { border-left: 4px solid var(--success); }
.integration-status-card.pending { border-left: 4px solid var(--warning); }
.integration-status-card p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.integration-status-card code { background: #eef1f7; padding: 2px 5px; border-radius: 5px; }
.integration-logo {
    width: 48px;
    height: 48px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    background: #e8f2ff;
    color: #1580e6;
    font-weight: 900;
}
.integration-pill {
    padding: 7px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 800;
    color: var(--muted);
    background: var(--surface-soft);
}
.integration-status-card.ready .integration-pill { color: var(--success); background: #eaf8f2; }
.integration-status-card.pending .integration-pill { color: var(--warning); background: #fff5df; }

.integration-note {
    margin-top: 18px;
    padding: 14px 16px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    border-radius: 12px;
    background: #f6f7fb;
    color: var(--muted);
    font-size: 13px;
}
.integration-note strong { color: var(--text); }

.gateway-mini-status {
    display: inline-flex;
    padding: 5px 8px;
    border-radius: 999px;
    background: #eef1f7;
    color: #667085;
    font-size: 10px;
    font-weight: 800;
    white-space: nowrap;
}
.gateway-mini-status.action_required,
.gateway-mini-status.created,
.gateway-mini-status.processing { color: #956400; background: #fff3d5; }
.gateway-mini-status.processed { color: #087a51; background: #e5f7ef; }
.gateway-mini-status.failed,
.gateway-mini-status.expired,
.gateway-mini-status.canceled { color: #b43449; background: #feecef; }

.payment-detail-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: 20px;
    align-items: start;
}
.payment-detail-grid .detail-main,
.payment-detail-grid .detail-side { display: grid; gap: 20px; }
.test-mode-banner {
    margin-bottom: 20px;
    padding: 13px 16px;
    border: 1px solid #f2d28b;
    border-radius: 12px;
    background: #fff8e7;
    color: #775309;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    font-size: 13px;
}
.payment-big-values {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-top: 18px;
}
.payment-big-values > div,
.gateway-info-grid > div,
.side-info-list > div {
    min-width: 0;
    padding: 14px;
    border-radius: 12px;
    background: var(--surface-soft);
}
.payment-big-values small,
.gateway-info-grid small,
.side-info-list small,
.digitable-box small { display: block; color: var(--muted); margin-bottom: 6px; font-size: 11px; }
.payment-big-values strong { font-size: 17px; }
.paid-info-strip,
.email-success-log {
    margin-top: 16px;
    padding: 12px 14px;
    border-radius: 10px;
    background: #eaf8f2;
    color: #087a51;
    font-size: 13px;
}
.boleto-empty { text-align: center; padding: 32px 18px 18px; }
.boleto-empty .empty-icon { margin-bottom: 14px; }
.boleto-empty p { color: var(--muted); }
.gateway-info-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-top: 18px;
}
.mono-text { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; overflow-wrap: anywhere; }
.digitable-box {
    margin-top: 16px;
    padding: 15px;
    border: 1px dashed #cfd6e2;
    border-radius: 12px;
    background: #fbfcff;
}
.digitable-box > div { display: flex; gap: 10px; align-items: center; }
.digitable-box code { flex: 1; overflow-wrap: anywhere; font-size: 13px; color: var(--text); }
.digitable-box button { border: 0; border-radius: 8px; padding: 8px 11px; cursor: pointer; color: var(--primary); background: #ece9ff; font-weight: 800; }
.boleto-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.boleto-actions form { margin: 0; }
.integration-error {
    display: grid;
    gap: 4px;
    margin-top: 16px;
    padding: 12px 14px;
    border-radius: 10px;
    background: #feeff1;
    color: #a62d42;
    font-size: 12px;
}
.integration-error.compact { margin-top: 12px; }
.side-info-list { display: grid; gap: 10px; margin: 18px 0; }
.side-info-list strong { line-height: 1.45; overflow-wrap: anywhere; }
.email-boleto-card .access-form { margin-top: 18px; }
.billing-address-grid { align-items: end; }
.mini-action:disabled,
.button:disabled { opacity: .48; cursor: not-allowed; }

@media (max-width: 1150px) {
    .payment-detail-grid { grid-template-columns: 1fr; }
    .payment-detail-grid .detail-side { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 850px) {
    .payment-big-values { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .integration-status-card { grid-template-columns: 48px minmax(0, 1fr); }
    .integration-pill { grid-column: 2; justify-self: start; }
}

@media (max-width: 650px) {
    .payment-detail-grid .detail-side { grid-template-columns: 1fr; }
    .payment-big-values,
    .gateway-info-grid { grid-template-columns: 1fr; }
    .digitable-box > div { align-items: stretch; flex-direction: column; }
    .payment-detail-header .header-actions { margin-top: 16px; }
}

/* v7 — cobranças recorrentes e baixas manuais */
.billing-choice-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.billing-choice {
    position: relative;
    display: grid;
    grid-template-columns: 46px 1fr;
    gap: 14px;
    align-items: center;
    min-height: 118px;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--surface-soft);
    cursor: pointer;
    transition: .2s ease;
}

.billing-choice:hover,
.billing-choice.selected {
    border-color: var(--primary);
    background: #f3f0ff;
    box-shadow: 0 0 0 3px rgba(103, 88, 232, .08);
}

.billing-choice.disabled {
    cursor: not-allowed;
    opacity: .58;
}

.billing-choice input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.billing-choice-icon {
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    border-radius: 13px;
    background: #e9e5ff;
    color: var(--primary);
    font-size: 23px;
    font-weight: 900;
}

.billing-choice strong,
.billing-choice small {
    display: block;
}

.billing-choice strong {
    margin-bottom: 6px;
}

.billing-choice small {
    color: var(--muted);
    line-height: 1.45;
}

.recurrence-explanation,
.manual-settlement-warning {
    margin-top: 16px;
    padding: 14px 16px;
    border-radius: 12px;
    display: grid;
    gap: 4px;
    font-size: 13px;
}

.recurrence-explanation {
    background: #eef8f4;
    border: 1px solid #d0eee1;
    color: #356b58;
}

.manual-settlement-warning {
    background: #fff6e6;
    border: 1px solid #f2d8a6;
    color: #7a5716;
}

.block-note {
    display: block;
    margin-top: 12px;
}

.recurrence-mini {
    color: var(--primary) !important;
    font-weight: 750;
    margin-top: 5px !important;
}

.payment-status.cortesia {
    color: #6f4aa5;
    background: #f1eafe;
}

.paid-info-strip.courtesy {
    background: #f4effc;
    color: #6f4aa5;
}

.paid-info-strip span {
    display: block;
    margin-top: 6px;
    font-size: 12px;
    opacity: .85;
}

.badge.neutral {
    color: #697386;
    background: #eef1f5;
}

.recurrence-card .side-info-list {
    margin: 16px 0;
}

.receive-form textarea {
    width: 100%;
    resize: vertical;
}

@media (max-width: 760px) {
    .billing-choice-grid {
        grid-template-columns: 1fr;
    }
}

/* v8 — e-mail automático */
.email-table-status {
    display: block;
    margin-top: 6px;
    font-size: 11px;
    font-weight: 750;
}

.email-table-status.success { color: var(--success); }
.email-table-status.danger { color: var(--danger); }
.email-table-status.pending { color: var(--warning); }
.email-table-status.muted { color: var(--muted); }

.email-rule-summary,
.config-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin: 18px 0;
}

.email-rule-summary > div,
.config-grid > div {
    padding: 13px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: var(--surface-soft);
    min-width: 0;
}

.email-rule-summary small,
.email-rule-summary strong,
.config-grid small,
.config-grid strong {
    display: block;
}

.email-rule-summary small,
.config-grid small {
    color: var(--muted);
    margin-bottom: 5px;
}

.email-rule-summary strong,
.config-grid strong {
    overflow-wrap: anywhere;
}

.email-pending-log {
    margin-top: 14px;
    padding: 12px;
    border-radius: 10px;
    background: #fff8e7;
    color: #836219;
    font-size: 12px;
}

.test-email-warning {
    display: grid;
    gap: 4px;
    margin: 15px 0;
    padding: 13px 14px;
    border: 1px solid #efcb69;
    border-radius: 11px;
    background: #fff8df;
    color: #6c5114;
    font-size: 12px;
}

.test-email-warning.large {
    margin-top: 20px;
    padding: 16px;
}

.settings-link {
    display: inline-block;
    margin-top: 15px;
    color: var(--primary);
    font-size: 12px;
    font-weight: 800;
}

.settings-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.55fr) minmax(300px, .8fr);
    gap: 20px;
    align-items: start;
}

.settings-main,
.settings-side {
    display: grid;
    gap: 20px;
}

.settings-flags {
    display: grid;
    gap: 10px;
    margin-top: 20px;
}

.settings-flag {
    display: grid;
    grid-template-columns: 38px 1fr;
    gap: 12px;
    align-items: center;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: var(--surface-soft);
}

.settings-flag > span {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    background: #edf0f5;
    color: var(--muted);
    font-weight: 900;
}

.settings-flag.active > span {
    background: #e8f7f0;
    color: var(--success);
}

.settings-flag strong,
.settings-flag small {
    display: block;
}

.settings-flag small {
    color: var(--muted);
    margin-top: 3px;
}

.env-example {
    margin: 18px 0 0;
    padding: 18px;
    border-radius: 12px;
    background: #11192a;
    color: #dbe2ef;
    overflow-x: auto;
    line-height: 1.65;
    font-size: 12px;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.setup-steps {
    margin: 18px 0 0;
    padding-left: 21px;
    color: var(--muted);
}

.setup-steps li {
    padding: 5px 0 5px 4px;
    line-height: 1.45;
}

.status-pill span.offline {
    background: var(--danger);
}

@media (max-width: 1100px) {
    .settings-layout {
        grid-template-columns: 1fr;
    }

    .settings-side {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 760px) {
    .email-rule-summary,
    .config-grid,
    .settings-side {
        grid-template-columns: 1fr;
    }
}

/* TV Digital v9 */
.warning-panel {
    border-color: #f4d48b;
    background: #fff8e6;
    color: #795200;
    margin-bottom: 22px;
}
.warning-panel p { margin: 6px 0 0; color: #795200; }
.tv-layout { align-items: start; }
.tv-metrics { margin-bottom: 24px; }
.tv-campaign-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.tv-campaign-card { min-height: 210px; }
.card-actions-stack { display: grid; gap: 8px; margin-top: auto; }
.card-actions-stack .button { width: 100%; text-align: center; justify-content: center; }
.actions-cell { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.actions-cell form { margin: 0; }
.inline-form select { min-width: 138px; }
.midia-edit-form { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.midia-edit-form input { width: 72px; padding: 8px 9px; border: 1px solid var(--line); border-radius: 9px; }

.days-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(88px, 1fr));
    gap: 9px;
    font-size: 12px;
    color: var(--muted);
}
.days-grid label {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    width: 100%;
    margin: 0;
    padding: 9px 10px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: #fbfcfe;
    color: #49556a;
    font-weight: 750;
    white-space: nowrap;
}
.days-grid input[type="checkbox"] {
    width: 16px;
    height: 16px;
    min-width: 16px;
    margin: 0;
    padding: 0;
    accent-color: var(--primary);
}
.days-grid label:has(input:checked) {
    border-color: rgba(103, 88, 232, .35);
    background: #f4f1ff;
    color: var(--primary-dark);
}

.preview-stage { display: grid; gap: 18px; }
.preview-item img, .preview-item video { width: min(100%, 900px); max-height: 520px; object-fit: contain; border-radius: 16px; background: #11192a; display: block; margin-top: 14px; }
select[multiple] { min-height: 94px; }
button[disabled], input[disabled], select[disabled], textarea[disabled] { opacity: .58; cursor: not-allowed; }
@media (max-width: 1050px) { .tv-campaign-grid { grid-template-columns: 1fr; } }

/* TV Digital v9.1 - layout de campanhas */
.tv-create-campaign-panel {
    display: grid;
    grid-template-columns: minmax(260px, .85fr) minmax(420px, 1.15fr);
    gap: 20px;
    align-items: end;
    margin-bottom: 24px;
}
.tv-create-campaign-copy h2 {
    margin-bottom: 6px;
}
.tv-create-campaign-copy p:last-child {
    margin-bottom: 0;
    font-size: 13px;
    line-height: 1.55;
}
.tv-create-campaign-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 13px;
    align-items: end;
}
.tv-create-campaign-form .field {
    margin: 0;
}
.tv-campaign-settings-form {
    margin-top: 0;
}
.tv-campaign-settings-title {
    margin-bottom: 2px;
}
.tv-campaign-settings-title .compact-switch {
    margin: 0;
}
.tv-active-switch {
    align-self: center;
    white-space: nowrap;
}
.tv-target-checks {
    display: grid;
    gap: 10px;
}
.tv-target-card {
    position: relative;
    display: block;
    cursor: pointer;
    border: 1px solid var(--line);
    border-radius: 13px;
    padding: 13px 43px 13px 13px;
    background: #fff;
    transition: .2s ease;
}
.tv-target-card input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}
.tv-target-card .check-visual {
    position: absolute;
    right: 13px;
    top: 13px;
    width: 23px;
    height: 23px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    border: 1px solid #dce2eb;
    color: transparent;
    font-size: 12px;
    font-weight: 900;
}
.tv-target-card strong,
.tv-target-card small {
    display: block;
}
.tv-target-card strong {
    font-size: 13px;
}
.tv-target-card small {
    color: var(--muted);
    font-size: 11px;
    line-height: 1.35;
    margin-top: 4px;
}
.tv-target-card:has(input:checked) {
    border-color: var(--primary);
    background: #faf9ff;
    box-shadow: 0 0 0 3px rgba(103, 88, 232, .08);
}
.tv-target-card input:checked ~ .check-visual {
    color: #fff;
    border-color: var(--primary);
    background: var(--primary);
}
@media (max-width: 1180px) {
    .tv-create-campaign-panel,
    .tv-create-campaign-form {
        grid-template-columns: 1fr;
    }
    .tv-create-campaign-form .button {
        width: 100%;
    }
}
@media (max-width: 560px) {
    .tv-campaign-settings-title {
        display: grid;
    }
    .tv-active-switch {
        margin-top: 12px;
    }
}


/* TV Digital v9.2 - tela de campanha */
.flash {
    transition: opacity .45s ease, transform .45s ease;
}
.flash.is-hiding {
    opacity: 0;
    transform: translateY(-8px);
}
.tv-media-actions-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    margin-bottom: 18px;
}
.tv-media-action-card {
    min-height: 100%;
}
.tv-media-action-card h2 {
    margin-bottom: 14px;
}
.tv-media-action-form {
    display: grid;
    gap: 12px;
}
.tv-media-action-form .form-grid.two-columns {
    gap: 12px;
}
.tv-campaign-detail-layout {
    grid-template-columns: minmax(0, 1.35fr) minmax(430px, .75fr);
}
@media (max-width: 1100px) {
    .tv-media-actions-grid,
    .tv-campaign-detail-layout {
        grid-template-columns: 1fr;
    }
}

/* TV Digital v9.3 - correção dos dias da campanha */

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

/* TV Digital v10 - finalização do módulo */
.tv-campaign-summary {
    margin-bottom: 18px;
}
.tv-campaign-summary .metric-card strong {
    font-size: 20px;
    line-height: 1.15;
    word-break: break-word;
}
.small-copy {
    font-size: 12px;
    line-height: 1.5;
}
.tv10-media-actions-grid {
    align-items: stretch;
}
.tv10-campaign-detail-layout {
    grid-template-columns: minmax(0, 1.15fr) minmax(410px, .85fr);
}
.media-title-row {
    align-items: start;
    gap: 14px;
}
.danger-outline {
    color: var(--danger) !important;
    border: 1px solid rgba(204, 63, 85, .25) !important;
    background: #fff5f7 !important;
}
.danger-outline:hover {
    background: #ffe9ee !important;
}
.tv10-media-list {
    display: grid;
    gap: 14px;
}
.tv10-media-card {
    display: grid;
    grid-template-columns: 190px minmax(0, 1fr);
    gap: 16px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 8px 22px rgba(25, 38, 64, .045);
}
.tv10-media-thumb {
    position: relative;
    min-height: 118px;
    overflow: hidden;
    border-radius: 13px;
    background: #11192a;
    display: grid;
    place-items: center;
}
.tv10-media-thumb img,
.tv10-media-thumb video {
    width: 100%;
    height: 100%;
    min-height: 118px;
    object-fit: cover;
    display: block;
}
.tv10-media-thumb.video video {
    object-fit: contain;
}
.tv10-order-badge {
    position: absolute;
    left: 10px;
    top: 10px;
    width: 30px;
    height: 30px;
    border-radius: 999px;
    display: grid;
    place-items: center;
    color: #fff;
    background: rgba(103, 88, 232, .94);
    font-weight: 900;
    z-index: 2;
    box-shadow: 0 6px 18px rgba(0,0,0,.2);
}
.youtube-thumb {
    color: #fff;
    display: grid;
    place-items: center;
    gap: 8px;
}
.youtube-thumb span {
    width: 54px;
    height: 54px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: rgba(255,255,255,.13);
    font-size: 24px;
}
.tv10-media-info {
    min-width: 0;
    display: grid;
    gap: 12px;
    align-content: start;
}
.tv10-media-info strong,
.tv10-media-info small {
    display: block;
}
.tv10-media-info strong {
    overflow-wrap: anywhere;
}
.tv10-media-info small {
    color: var(--muted);
    font-size: 12px;
    line-height: 1.45;
    overflow-wrap: anywhere;
}
.tv10-media-edit-form {
    display: flex;
    gap: 9px;
    align-items: end;
    flex-wrap: wrap;
}
.tv10-media-edit-form label {
    display: grid;
    gap: 5px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
}
.tv10-media-edit-form input {
    width: 92px;
    padding: 9px 10px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fbfcfe;
}
.tv10-media-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}
.tv10-empty-media {
    min-height: 125px;
    display: grid;
    place-items: center;
}
.tv10-settings-side {
    display: grid;
    gap: 18px;
}
.tv10-campaign-tools h2 {
    margin-bottom: 12px;
}
.tool-stack {
    display: grid;
    gap: 9px;
}
.tool-stack form {
    margin: 0;
}
.tool-stack .button {
    justify-content: center;
    text-align: center;
}
.tv10-campaign-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}
.tv10-dashboard-campaign-card {
    min-height: 260px;
}
.tv10-campaign-meta {
    display: grid;
    gap: 6px;
    margin: 12px 0;
    color: var(--muted);
    font-size: 12px;
}
.tv10-letreiro-preview {
    border-left: 3px solid var(--primary);
    padding-left: 10px;
    font-size: 12px;
    line-height: 1.45;
    max-height: 58px;
    overflow: hidden;
}
.tv10-campaign-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}
.tv10-campaign-actions form,
.tv10-campaign-actions a,
.tv10-campaign-actions button {
    width: 100%;
}
.tv10-helper-card .setup-steps {
    margin-top: 10px;
}
.preview-stage.tv10-preview-stage {
    display: grid;
    gap: 22px;
}
.tv10-preview-item {
    overflow: hidden;
}
.tv10-preview-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
    margin: 10px 0 14px;
}
.tv10-preview-screen {
    background: #11192a;
    border-radius: 18px;
    padding: 18px;
    min-height: 360px;
    display: grid;
    place-items: center;
}
.tv10-preview-screen img,
.tv10-preview-screen video {
    width: 100%;
    max-height: 560px;
    object-fit: contain;
    border-radius: 12px;
}
.tv10-preview-youtube {
    color: #fff;
    text-align: center;
    display: grid;
    gap: 12px;
}
@media (max-width: 1250px) {
    .tv10-campaign-detail-layout,
    .tv10-campaign-grid {
        grid-template-columns: 1fr;
    }
}
@media (max-width: 760px) {
    .tv10-media-card {
        grid-template-columns: 1fr;
    }
    .tv10-media-thumb,
    .tv10-media-thumb img,
    .tv10-media-thumb video {
        min-height: 180px;
    }
    .tv10-campaign-actions {
        grid-template-columns: 1fr;
    }
    .tv10-media-edit-form input {
        width: 100%;
    }
    .tv10-media-edit-form label {
        flex: 1 1 130px;
    }
}


/* ============================================================
   TV Digital v10.1 — salvar no topo e preview em formato TV
   ============================================================ */

.tv101-settings-header {
    align-items: flex-start;
    gap: 18px;
    margin-bottom: 22px;
}

.tv101-settings-top-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 10px;
}

.tv101-delete-campaign-form {
    margin: 0;
}

.tv101-preview-panel {
    padding: clamp(18px, 3vw, 34px);
}

.tv101-tv-frame {
    width: min(1180px, 100%);
    margin: 0 auto;
}

.tv101-tv-screen {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border: 12px solid #111827;
    border-radius: 24px;
    background: #05070c;
    box-shadow:
        0 30px 65px rgba(17, 24, 39, .22),
        inset 0 0 0 1px rgba(255, 255, 255, .06);
}

.tv101-preview-slide {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity .35s ease;
    background: #05070c;
}

.tv101-preview-slide.is-active {
    opacity: 1;
    visibility: visible;
    z-index: 2;
}

.tv101-preview-slide img,
.tv101-preview-slide video,
.tv101-preview-slide iframe {
    width: 100%;
    height: 100%;
    border: 0;
    object-fit: contain;
    background: #05070c;
}

.tv101-youtube-fallback {
    display: grid;
    place-items: center;
    gap: 14px;
    color: #fff;
    text-align: center;
}

.tv101-youtube-fallback > span {
    font-size: 58px;
}

.tv101-youtube-fallback a {
    color: #fff;
    text-decoration: underline;
}

.tv101-preview-ticker {
    position: absolute;
    z-index: 8;
    left: 0;
    right: 0;
    bottom: 0;
    overflow: hidden;
    padding: 10px 0;
    color: #fff;
    background: rgba(5, 7, 12, .86);
    white-space: nowrap;
}

.tv101-preview-ticker span {
    display: inline-block;
    min-width: 100%;
    padding-left: 100%;
    animation: tv101Ticker 18s linear infinite;
    font-weight: 750;
}

@keyframes tv101Ticker {
    from { transform: translateX(0); }
    to { transform: translateX(-100%); }
}

.tv101-tv-stand {
    width: 24%;
    height: 16px;
    margin: 0 auto;
    border-radius: 0 0 18px 18px;
    background: #1f2937;
    box-shadow: 0 8px 22px rgba(17, 24, 39, .18);
}

.tv101-preview-toolbar {
    display: grid;
    grid-template-columns: auto minmax(180px, 1fr) auto auto;
    align-items: center;
    gap: 12px;
    width: min(1180px, 100%);
    margin: 24px auto 0;
}

.tv101-current-media {
    min-width: 0;
    text-align: center;
}

.tv101-current-media strong,
.tv101-current-media small {
    display: block;
}

.tv101-current-media strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tv101-current-media small {
    margin-top: 4px;
    color: var(--muted);
}

.tv101-preview-progress {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 18px;
}

.tv101-preview-dot {
    width: 10px;
    height: 10px;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: #cfd6e3;
    cursor: pointer;
    transition: width .2s ease, background .2s ease;
}

.tv101-preview-dot.is-active {
    width: 28px;
    background: var(--primary);
}

@media (max-width: 1080px) {
    .tv101-settings-header {
        display: grid;
    }

    .tv101-settings-top-actions {
        justify-content: flex-start;
    }
}

@media (max-width: 720px) {
    .tv101-settings-top-actions {
        display: grid;
        grid-template-columns: 1fr;
        width: 100%;
    }

    .tv101-settings-top-actions .button,
    .tv101-delete-campaign-form,
    .tv101-delete-campaign-form .button {
        width: 100%;
    }

    .tv101-tv-screen {
        border-width: 7px;
        border-radius: 16px;
    }

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

    .tv101-current-media {
        grid-column: 1 / -1;
        grid-row: 1;
    }
}


/* TV Digital v10.4 — gerenciamento de APK */
.app-update-current {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 20px;
    padding: 24px;
}
.app-update-current h2 { margin-bottom: 6px; }
.app-update-current p { margin-bottom: 0; color: var(--muted); }
.app-update-current-meta { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.app-update-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.55fr) minmax(280px, .8fr);
    gap: 18px;
    margin-bottom: 20px;
}
.app-update-check {
    align-items: flex-start;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fbfcfe;
}
.app-update-check strong,
.app-update-check small { display: block; }
.app-update-check small { margin-top: 4px; color: var(--muted); }
.endpoint-code {
    display: block;
    overflow-wrap: anywhere;
    padding: 14px;
    border-radius: 12px;
    background: #11192a;
    color: #dfe5f2;
    line-height: 1.55;
}
.app-update-tip { margin-top: 16px; line-height: 1.6; }
.table-actions { display: flex; gap: 7px; flex-wrap: wrap; }
.table-actions form { margin: 0; }
.mini-action.danger { color: var(--danger); border-color: #f1cbd2; background: #fff; }
@media (max-width: 960px) {
    .app-update-grid { grid-template-columns: 1fr; }
}
@media (max-width: 680px) {
    .app-update-current { align-items: flex-start; flex-direction: column; }
}


/* v10.4.1 — áreas internas de Configurações */
.settings-section-nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin: -8px 0 24px;
}
.settings-section-nav a {
    display: flex;
    align-items: center;
    gap: 13px;
    min-width: 0;
    padding: 15px 17px;
    border: 1px solid var(--line);
    border-radius: 15px;
    background: var(--surface);
    color: var(--text);
    box-shadow: 0 7px 22px rgba(25, 38, 64, .045);
    transition: border-color .2s ease, transform .2s ease, box-shadow .2s ease;
}
.settings-section-nav a:hover {
    transform: translateY(-1px);
    border-color: rgba(103, 88, 232, .35);
    box-shadow: 0 11px 26px rgba(25, 38, 64, .075);
}
.settings-section-nav a.active {
    border-color: rgba(103, 88, 232, .55);
    background: #f5f3ff;
    box-shadow: inset 3px 0 0 var(--primary), 0 9px 24px rgba(103, 88, 232, .10);
}
.settings-section-nav a > span {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: #eeebff;
    color: var(--primary);
    font-size: 19px;
    font-weight: 900;
}
.settings-section-nav strong,
.settings-section-nav small {
    display: block;
}
.settings-section-nav strong {
    font-size: 14px;
}
.settings-section-nav small {
    margin-top: 3px;
    color: var(--muted);
    font-size: 11px;
}
@media (max-width: 680px) {
    .settings-section-nav {
        grid-template-columns: 1fr;
    }
}
