/* =====================================================================
   SENDBUNKER — estilos base da aplicação
   Regra do projecto: border-radius máximo de 4px.
   ===================================================================== */

/* ---------- Tokens ---------- */
:root {
    --sb-ink: #12041f;
    --sb-ink-soft: #3a2d4a;
    --sb-brand: #4cc3f1;
    --sb-brand-dark: #1597c9;
    --sb-brand-soft: #e8f7fd;

    --sb-bg: #f4f5f9;
    --sb-surface: #ffffff;
    --sb-border: #e3e5ec;
    --sb-muted: #6b7280;

    --sb-success: #16a34a;
    --sb-warning: #d97706;
    --sb-danger: #dc2626;

    --sb-radius: 4px;
    --sb-topbar-h: 60px;
    --sb-font: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ---------- Base ---------- */
html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    background: var(--sb-bg);
    color: var(--sb-ink);
    font-family: var(--sb-font);
    font-size: 14px;
    line-height: 1.5;
}

body.sb-lock {
    overflow: hidden;
}

.sb-app {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.sb-main {
    flex: 1;
    width: 100%;
}

.sb-container {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 28px 24px 48px;
}

.sb-page-head {
    margin-bottom: 24px;
}

.sb-page-title {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.01em;
    margin: 0;
    color: var(--sb-ink);
}

.sb-page-sub {
    margin: 4px 0 0;
    color: var(--sb-muted);
}

/* ---------- Topbar ---------- */
.sb-topbar {
    position: sticky;
    top: 0;
    z-index: 1030;
    background: var(--sb-surface);
    border-top: 3px solid var(--sb-brand);
    border-bottom: 1px solid var(--sb-border);
}

.sb-topbar__inner {
    display: flex;
    align-items: center;
    gap: 28px;
    height: var(--sb-topbar-h);
    max-width: 1600px;
    margin: 0 auto;
    padding: 0 24px;
}

.sb-burger {
    display: none;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    background: none;
    border: 1px solid var(--sb-border);
    border-radius: var(--sb-radius);
    color: var(--sb-ink);
    cursor: pointer;
}

.sb-brand {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.sb-brand__full {
    height: 26px;
    width: auto;
    display: block;
}

.sb-brand__icon {
    height: 34px;
    width: auto;
    display: none;
}

/* ---------- Navegação ---------- */
.sb-nav {
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 0;
}

.sb-nav__head {
    display: none;
}

.sb-nav__list {
    display: flex;
    align-items: center;
    gap: 2px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.sb-nav__list li {
    display: block;
    margin: 0;
}

.sb-nav__link {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    height: var(--sb-topbar-h);
    padding: 0 14px;
    color: var(--sb-ink-soft);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    white-space: nowrap;
    transition: color .15s;
}

.sb-nav__link i {
    width: 16px;
    text-align: center;
    font-size: 14px;
    color: var(--sb-muted);
}

.sb-nav__link:hover {
    color: var(--sb-ink);
}

.sb-nav__link.active {
    color: var(--sb-ink);
    font-weight: 600;
}

.sb-nav__link.active i {
    color: var(--sb-brand-dark);
}

.sb-nav__link.active::after {
    content: "";
    position: absolute;
    left: 14px;
    right: 14px;
    bottom: 0;
    height: 3px;
    background: var(--sb-brand);
    border-radius: 2px 2px 0 0;
}

.sb-nav__link.is-disabled {
    cursor: not-allowed;
    opacity: .55;
}

.sb-nav__link.is-disabled:hover {
    color: var(--sb-ink-soft);
}

.sb-tag {
    font-style: normal;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
    padding: 1px 5px;
    color: var(--sb-muted);
    background: var(--sb-bg);
    border: 1px solid var(--sb-border);
    border-radius: 3px;
}

.sb-overlay {
    position: fixed;
    inset: 0;
    z-index: 1;
    background: rgba(18, 4, 31, .5);
    opacity: 0;
    visibility: hidden;
    transition: opacity .2s, visibility .2s;
}

.sb-overlay.is-open {
    opacity: 1;
    visibility: visible;
}

/* ---------- Menu do utilizador ---------- */
.sb-user {
    position: relative;
    margin-left: auto;
    z-index: 3;
}

.sb-user__btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 5px 8px;
    background: none;
    border: 1px solid transparent;
    border-radius: var(--sb-radius);
    color: var(--sb-ink);
    cursor: pointer;
}

.sb-user__btn:hover,
.sb-user__btn[aria-expanded="true"] {
    background: var(--sb-bg);
    border-color: var(--sb-border);
}

.sb-avatar {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--sb-ink);
    color: var(--sb-brand);
    border-radius: var(--sb-radius);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .02em;
}

.sb-user__meta {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
    line-height: 1.2;
}

.sb-user__name,
.sb-user__mail {
    max-width: 170px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sb-user__name {
    font-size: 13px;
    font-weight: 600;
}

.sb-user__mail {
    font-size: 11px;
    color: var(--sb-muted);
}

.sb-user__caret {
    font-size: 10px;
    color: var(--sb-muted);
}

.sb-user__menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 230px;
    display: none;
    padding: 6px;
    background: var(--sb-surface);
    border: 1px solid var(--sb-border);
    border-radius: var(--sb-radius);
    box-shadow: 0 8px 24px rgba(18, 4, 31, .12);
}

.sb-user__menu.is-open {
    display: block;
}

.sb-user__head {
    padding: 8px 10px 10px;
    margin-bottom: 6px;
    border-bottom: 1px solid var(--sb-border);
}

.sb-user__head strong {
    display: block;
    font-size: 13px;
}

.sb-user__head span {
    font-size: 12px;
    color: var(--sb-muted);
    word-break: break-all;
}

.sb-user__item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: 3px;
    color: var(--sb-ink-soft);
    font-size: 13px;
    text-decoration: none;
}

.sb-user__item:hover {
    background: var(--sb-bg);
    color: var(--sb-ink);
}

.sb-user__item--danger {
    color: var(--sb-danger);
}

.sb-user__item--danger:hover {
    color: var(--sb-danger);
    background: #fef2f2;
}

/* ---------- Componentes ---------- */
.sb-card {
    background: var(--sb-surface);
    border: 1px solid var(--sb-border);
    border-radius: var(--sb-radius);
}

.sb-card__head {
    padding: 16px 20px;
    border-bottom: 1px solid var(--sb-border);
}

.sb-card__title {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
}

.sb-card__sub {
    margin: 2px 0 0;
    font-size: 13px;
    color: var(--sb-muted);
}

.sb-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--sb-ink);
    border: 1px solid var(--sb-ink);
    border-radius: var(--sb-radius);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    transition: background .15s, border-color .15s;
}

.sb-btn:hover {
    background: var(--sb-brand-dark);
    border-color: var(--sb-brand-dark);
    color: #fff;
}

.sb-btn--ghost {
    background: transparent;
    color: var(--sb-ink);
    border-color: var(--sb-border);
}

.sb-btn--ghost:hover {
    background: var(--sb-bg);
    border-color: var(--sb-ink-soft);
    color: var(--sb-ink);
}

.sb-btn.is-disabled {
    opacity: .5;
    pointer-events: none;
}

/* Passos (dashboard — primeiros passos) */
.sb-steps {
    list-style: none;
    margin: 0;
    padding: 0;
}

.sb-step {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--sb-border);
}

.sb-step:last-child {
    border-bottom: 0;
}

.sb-step__num {
    flex: 0 0 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--sb-bg);
    color: var(--sb-muted);
    border-radius: var(--sb-radius);
    font-weight: 700;
}

.sb-step.is-done .sb-step__num {
    background: var(--sb-success);
    color: #fff;
}

.sb-step__body {
    flex: 1;
    min-width: 0;
}

.sb-step__title {
    margin: 0;
    font-weight: 600;
}

.sb-step__text {
    margin: 2px 0 0;
    font-size: 13px;
    color: var(--sb-muted);
}

/* ---------- Normalização do template base (raio máx. 4px) ---------- */
.card,
.btn,
.form-control,
.form-select,
.modal-content,
.alert,
.badge,
.dropdown-menu,
.nav-tabs .nav-link,
.nav-tabs-solid .nav-link {
    border-radius: var(--sb-radius);
}

.btn-submit,
.btn-added {
    background: var(--sb-ink);
    border-color: var(--sb-ink);
    color: #fff;
}

.btn-submit:hover,
.btn-added:hover {
    background: var(--sb-brand-dark);
    border-color: var(--sb-brand-dark);
    color: #fff;
}

/* ---------- Mobile / tablet ---------- */
@media (max-width: 991.98px) {
    .sb-topbar__inner {
        gap: 12px;
        padding: 0 12px;
    }

    .sb-container {
        padding: 20px 16px 40px;
    }

    .sb-burger {
        display: flex;
    }

    .sb-brand__full {
        height: 22px;
    }

    .sb-nav {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        z-index: 2;
        width: 290px;
        max-width: 85vw;
        flex-direction: column;
        align-items: stretch;
        flex: none;
        overflow-y: auto;
        background: var(--sb-surface);
        box-shadow: 8px 0 32px rgba(18, 4, 31, .18);
        transform: translateX(-100%);
        transition: transform .25s ease;
    }

    .sb-nav.is-open {
        transform: none;
    }

    .sb-nav__head {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 14px 16px;
        border-bottom: 1px solid var(--sb-border);
    }

    .sb-nav__head img {
        height: 24px;
        width: auto;
    }

    .sb-nav__close {
        width: 34px;
        height: 34px;
        background: none;
        border: 1px solid var(--sb-border);
        border-radius: var(--sb-radius);
        color: var(--sb-ink);
        cursor: pointer;
    }

    .sb-nav__list {
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        padding: 8px 0;
    }

    .sb-nav__link {
        height: 48px;
        padding: 0 20px;
        border-left: 3px solid transparent;
    }

    .sb-nav__link.active {
        background: var(--sb-brand-soft);
        border-left-color: var(--sb-brand);
    }

    .sb-nav__link.active::after {
        display: none;
    }

    .sb-user__meta,
    .sb-user__caret {
        display: none;
    }

    .sb-user__btn {
        padding: 3px;
    }
}

@media (max-width: 575.98px) {
    .sb-brand__full {
        display: none;
    }

    .sb-brand__icon {
        display: block;
    }

    .sb-page-title {
        font-size: 20px;
    }

    .sb-step {
        flex-wrap: wrap;
        padding: 14px 16px;
    }

    .sb-step .sb-btn {
        width: 100%;
    }
}

/* =====================================================================
   Dropdowns da navegação
   ===================================================================== */
button.sb-nav__link {
    background: none;
    border-top: 0;
    border-right: 0;
    border-bottom: 0;
    font-family: inherit;
    text-align: left;
    cursor: pointer;
}

.sb-dd {
    position: relative;
}

.sb-dd__caret {
    margin-left: 2px;
    font-size: 10px !important;
    transition: transform .15s;
}

.sb-dd.is-open>.sb-nav__link .sb-dd__caret {
    transform: rotate(180deg);
}

.sb-dd__panel {
    display: none;
}

.sb-dd.is-open>.sb-dd__panel {
    display: block;
}

.sb-dd__item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: 3px;
    color: var(--sb-ink-soft);
    font-size: 13px;
    text-decoration: none;
    white-space: nowrap;
}

.sb-dd__item i {
    width: 16px;
    text-align: center;
    color: var(--sb-muted);
}

.sb-dd__item:hover {
    background: var(--sb-bg);
    color: var(--sb-ink);
}

.sb-dd__item.active {
    background: var(--sb-brand-soft);
    color: var(--sb-ink);
    font-weight: 600;
}

.sb-dd__item.active i {
    color: var(--sb-brand-dark);
}

.sb-dd__item.is-disabled {
    opacity: .55;
    cursor: not-allowed;
}

.sb-dd__item.is-disabled:hover {
    background: none;
    color: var(--sb-ink-soft);
}

.sb-dd__item .sb-tag {
    margin-left: auto;
}

/* Desktop: painel flutuante */
@media (min-width: 992px) {
    button.sb-nav__link {
        border-left: 0;
    }

    .sb-nav__link {
        padding: 0 12px;
    }

    .sb-nav__link.active::after {
        left: 12px;
        right: 12px;
    }

    .sb-dd__panel {
        position: absolute;
        top: 100%;
        left: 0;
        z-index: 5;
        min-width: 240px;
        padding: 6px;
        background: var(--sb-surface);
        border: 1px solid var(--sb-border);
        border-radius: var(--sb-radius);
        box-shadow: 0 8px 24px rgba(18, 4, 31, .12);
    }
}

/* Entre tablet e desktop pequeno: só o avatar, para a navegação respirar */
@media (max-width: 1199.98px) {

    .sb-user__meta,
    .sb-user__caret {
        display: none;
    }

    .sb-user__btn {
        padding: 3px;
    }
}

/* Mobile: acordeão dentro da gaveta */
@media (max-width: 991.98px) {
    button.sb-nav__link {
        width: 100%;
        border-left: 3px solid transparent;
    }

    .sb-dd__caret {
        margin-left: auto;
    }

    .sb-dd__panel {
        padding: 4px 0;
        background: var(--sb-bg);
        border-top: 1px solid var(--sb-border);
        border-bottom: 1px solid var(--sb-border);
    }

    .sb-dd__item {
        padding: 11px 20px 11px 48px;
        border-radius: 0;
    }
}

/* =====================================================================
   Página 404
   ===================================================================== */
.sb-404-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px 16px;
}

.sb-404 {
    width: 100%;
    max-width: 520px;
    padding: 40px 32px;
    text-align: center;
    background: var(--sb-surface);
    border: 1px solid var(--sb-border);
    border-top: 3px solid var(--sb-brand);
    border-radius: var(--sb-radius);
}

.sb-404__logo {
    height: 28px;
    width: auto;
    margin-bottom: 28px;
}

.sb-404__code {
    margin: 0;
    font-size: 72px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: -.03em;
    color: var(--sb-ink);
}

.sb-404__code span {
    color: var(--sb-brand);
}

.sb-404__title {
    margin: 16px 0 6px;
    font-size: 20px;
    font-weight: 700;
}

.sb-404__text {
    margin: 0 0 28px;
    color: var(--sb-muted);
}

.sb-404__actions {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
}

@media (max-width: 575.98px) {
    .sb-404 {
        padding: 32px 20px;
    }

    .sb-404__code {
        font-size: 56px;
    }

    .sb-404__actions .sb-btn {
        width: 100%;
    }
}

/* =====================================================================
   Contactos
   ===================================================================== */
.sb-card__body {
    padding: 20px;
}

.sb-hint {
    margin: 0 0 12px;
    font-size: 13px;
    color: var(--sb-muted);
}

.sb-hint code {
    color: var(--sb-brand-dark);
    background: var(--sb-brand-soft);
    padding: 1px 5px;
    border-radius: 3px;
}

.sb-subnav {
    display: flex;
    gap: 4px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--sb-border);
    overflow-x: auto;
}

.sb-subnav a {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: -1px;
    padding: 10px 14px;
    color: var(--sb-muted);
    font-weight: 500;
    text-decoration: none;
    white-space: nowrap;
    border-bottom: 3px solid transparent;
}

.sb-subnav a:hover {
    color: var(--sb-ink);
}

.sb-subnav a.active {
    color: var(--sb-ink);
    font-weight: 600;
    border-bottom-color: var(--sb-brand);
}

/* Barra de ferramentas dos cartões */
.sb-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--sb-border);
}

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

.sb-toolbar__search {
    position: relative;
    flex: 1 1 240px;
    min-width: 0;
}

.sb-toolbar__search i {
    position: absolute;
    top: 50%;
    left: 12px;
    transform: translateY(-50%);
    font-size: 13px;
    color: var(--sb-muted);
    pointer-events: none;
}

.sb-toolbar__search input {
    padding-left: 34px;
}

.sb-toolbar .form-select {
    flex: 0 1 200px;
    width: auto;
}

/* Tabela */
.sb-table {
    margin: 0;
    vertical-align: middle;
}

.sb-table th {
    padding: 10px 16px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--sb-muted);
    background: var(--sb-bg);
    border-bottom: 1px solid var(--sb-border);
    white-space: nowrap;
}

.sb-table td {
    padding: 12px 16px;
    border-color: var(--sb-border);
}

.sb-contact {
    display: flex;
    flex-direction: column;
    line-height: 1.3;
    min-width: 0;
}

.sb-contact strong {
    font-weight: 600;
}

.sb-contact span {
    font-size: 12px;
    color: var(--sb-muted);
    word-break: break-all;
}

.sb-actions {
    white-space: nowrap;
}

.sb-actions .sb-btn+.sb-btn {
    margin-left: 4px;
}

/* Paginação */
.sb-pager {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    border-top: 1px solid var(--sb-border);
    font-size: 13px;
}

.sb-pager__btns {
    display: flex;
    gap: 6px;
}

/* Botões extra */
.sb-btn--sm {
    padding: 5px 10px;
    font-size: 12px;
}

.sb-btn--icon {
    width: 38px;
    padding: 0;
}

.sb-btn--icon.sb-btn--sm {
    width: 30px;
    height: 30px;
}

.sb-btn--danger {
    color: var(--sb-danger);
}

.sb-btn--danger:hover {
    background: #fef2f2;
    border-color: var(--sb-danger);
    color: var(--sb-danger);
}

.sb-btn:disabled {
    opacity: .5;
    pointer-events: none;
}

.sb-modal-foot {
    justify-content: space-between;
}

/* Campos personalizados (nome / valor) */
.sb-kv {
    display: grid;
    grid-template-columns: 1fr 1.4fr auto;
    gap: 8px;
    margin-bottom: 8px;
}

/* Caixas de listas no modal */
.sb-checks {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px;
    border: 1px solid var(--sb-border);
    border-radius: var(--sb-radius);
    max-height: 150px;
    overflow-y: auto;
}

.sb-check {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    padding: 4px 10px;
    background: var(--sb-bg);
    border: 1px solid var(--sb-border);
    border-radius: var(--sb-radius);
    font-size: 13px;
    cursor: pointer;
}

/* Grelha de inserção em massa */
.sb-bulkbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.sb-bulkbar .form-control {
    flex: 0 1 240px;
}

.sb-grid-wrap {
    overflow: auto;
    max-height: 420px;
    border: 1px solid var(--sb-border);
    border-radius: var(--sb-radius);
}

.sb-grid {
    width: 100%;
    min-width: 520px;
    border-collapse: collapse;
}

.sb-grid th {
    position: sticky;
    top: 0;
    z-index: 1;
    padding: 8px 10px;
    font-size: 12px;
    font-weight: 600;
    text-align: left;
    white-space: nowrap;
    color: var(--sb-ink-soft);
    background: var(--sb-bg);
    border-bottom: 1px solid var(--sb-border);
    border-right: 1px solid var(--sb-border);
}

.sb-grid td {
    padding: 0;
    border-bottom: 1px solid var(--sb-border);
    border-right: 1px solid var(--sb-border);
}

.sb-grid__n {
    width: 40px;
    text-align: center !important;
    font-size: 12px;
    color: var(--sb-muted);
    background: var(--sb-bg);
}

.sb-grid input {
    width: 100%;
    min-width: 150px;
    padding: 8px 10px;
    font-size: 13px;
    color: var(--sb-ink);
    background: transparent;
    border: 0;
    outline: 0;
}

.sb-grid input:focus {
    background: var(--sb-brand-soft);
    box-shadow: inset 0 0 0 2px var(--sb-brand);
}

.sb-grid__x {
    padding: 0 4px;
    font-size: 16px;
    line-height: 1;
    color: var(--sb-muted);
    background: none;
    border: 0;
    cursor: pointer;
}

.sb-grid__x:hover {
    color: var(--sb-danger);
}

@media (max-width: 575.98px) {

    .sb-toolbar .form-select,
    .sb-toolbar .sb-btn,
    .sb-toolbar>div:first-child {
        flex: 1 1 100%;
        width: 100%;
    }

    .sb-kv {
        grid-template-columns: 1fr 1fr auto;
    }

    .sb-bulkbar .form-control,
    .sb-bulkbar .sb-btn {
        flex: 1 1 100%;
    }

    .sb-card__body {
        padding: 16px;
    }

    .sb-actions {
        white-space: normal;
    }
}

/* =====================================================================
   Tipo de contacto, detalhes e chips
   ===================================================================== */
.sb-type {
    display: inline-block;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
    border-radius: 3px;
}

.sb-type--person {
    color: #0e7490;
    background: #e0f7fb;
}

.sb-type--company {
    color: #5b21b6;
    background: #ede9fe;
}

.sb-details {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px 24px;
    margin: 0;
}

.sb-details dt {
    margin: 0;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--sb-muted);
}

.sb-details dd {
    margin: 3px 0 0;
    word-break: break-word;
}

.sb-details .full {
    grid-column: 1 / -1;
}

.sb-chip {
    display: inline-block;
    margin: 0 6px 6px 0;
    padding: 3px 9px;
    font-size: 12px;
    background: var(--sb-bg);
    border: 1px solid var(--sb-border);
    border-radius: var(--sb-radius);
}

.sb-chip b {
    margin-right: 4px;
    color: var(--sb-brand-dark);
    font-weight: 600;
}

@media (max-width: 575.98px) {
    .sb-details {
        grid-template-columns: 1fr;
    }
}

/* =====================================================================
   Templates
   ===================================================================== */
.sb-container--wide {
    max-width: 1600px;
}

/* Cartões da galeria / lista */
.tpl-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
    padding: 16px;
}

.tpl-card {
    display: flex;
    flex-direction: column;
    background: var(--sb-surface);
    border: 1px solid var(--sb-border);
    border-radius: var(--sb-radius);
    overflow: hidden;
    transition: border-color .15s, box-shadow .15s;
}

.tpl-card:hover {
    border-color: var(--sb-brand);
    box-shadow: 0 4px 16px rgba(18, 4, 31, .08);
}

/* iframe a 200% e escalado a 50%: a miniatura ajusta-se a qualquer largura */
.tpl-thumb {
    position: relative;
    height: 300px;
    overflow: hidden;
    background: var(--sb-bg);
    border-bottom: 1px solid var(--sb-border);
}

.tpl-thumb iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 200%;
    height: 200%;
    border: 0;
    background: #fff;
    transform: scale(.5);
    transform-origin: 0 0;
    pointer-events: none;
}

.tpl-card__body {
    flex: 1;
    padding: 14px 16px 8px;
    min-width: 0;
}

.tpl-card__body h3 {
    margin: 0 0 4px;
    font-size: 15px;
    font-weight: 700;
}

.tpl-card__body p {
    margin: 0;
    font-size: 13px;
    color: var(--sb-muted);
    display: -webkit-box;
    /* -webkit-line-clamp: 2; */
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.tpl-card__meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    font-size: 12px;
    color: var(--sb-muted);
}

.tpl-card__foot {
    display: flex;
    gap: 8px;
    padding: 12px 16px 16px;
}

.tpl-card__foot .sb-btn {
    flex: 1;
}

.tpl-badge {
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 600;
    color: var(--sb-brand-dark);
    background: var(--sb-brand-soft);
    border-radius: 3px;
}

.tpl-empty {
    grid-column: 1 / -1;
    padding: 40px 16px;
    text-align: center;
    color: var(--sb-muted);
}

.tpl-empty i {
    margin-bottom: 12px;
    font-size: 32px;
    color: var(--sb-brand);
}

.tpl-empty .sb-btn {
    margin: 4px;
}

.tpl-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 14px 16px 0;
}

.tpl-chips button {
    padding: 5px 12px;
    font-size: 13px;
    color: var(--sb-ink-soft);
    background: var(--sb-surface);
    border: 1px solid var(--sb-border);
    border-radius: var(--sb-radius);
    cursor: pointer;
}

.tpl-chips button.is-active {
    color: #fff;
    background: var(--sb-ink);
    border-color: var(--sb-ink);
}

.tpl-modal-frame {
    border: 1px solid var(--sb-border);
    border-radius: var(--sb-radius);
    background: var(--sb-bg);
}

.tpl-modal-frame iframe {
    display: block;
    width: 100%;
    height: 62vh;
    border: 0;
    background: #fff;
}

/* ---------- Editor ---------- */
.tpl-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
    padding: 10px 12px;
    background: var(--sb-surface);
    border: 1px solid var(--sb-border);
    border-radius: var(--sb-radius);
}

.tpl-bar__name {
    flex: 1 1 200px;
    min-width: 0;
    font-weight: 600;
}

.tpl-bar__status {
    font-size: 12px;
    color: var(--sb-muted);
    white-space: nowrap;
}

.tpl-bar__status.is-dirty {
    color: var(--sb-warning);
}

.tpl-bar__actions {
    display: flex;
    gap: 8px;
}

.tpl-mtabs {
    display: none;
    margin-bottom: 12px;
}

.tpl-mtabs button {
    flex: 1;
    padding: 10px;
    font-weight: 600;
    color: var(--sb-muted);
    background: var(--sb-surface);
    border: 1px solid var(--sb-border);
    cursor: pointer;
}

.tpl-mtabs button:first-child {
    border-radius: var(--sb-radius) 0 0 var(--sb-radius);
}

.tpl-mtabs button:last-child {
    border-radius: 0 var(--sb-radius) var(--sb-radius) 0;
    border-left: 0;
}

.tpl-mtabs button.is-active {
    color: #fff;
    background: var(--sb-ink);
    border-color: var(--sb-ink);
}

.tpl-layout {
    display: grid;
    grid-template-columns: minmax(360px, 460px) minmax(0, 1fr);
    gap: 16px;
    align-items: start;
}

.tpl-side {
    max-height: calc(100vh - 160px);
    overflow-y: auto;
    padding-right: 4px;
}

.tpl-box {
    margin-bottom: 14px;
    padding: 16px;
}

.tpl-box__title {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: .02em;
    text-transform: uppercase;
    color: var(--sb-ink-soft);
}

.tpl-box__sub {
    margin: 16px 0 8px;
    font-size: 12px;
    font-weight: 600;
    color: var(--sb-muted);
}

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

.tpl-field {
    min-width: 0;
}

.tpl-field.is-full {
    grid-column: 1 / -1;
}

.tpl-field label {
    display: block;
    margin-bottom: 4px;
    font-size: 12px;
    font-weight: 600;
    color: var(--sb-ink-soft);
}

.tpl-help {
    margin-top: 3px;
    font-size: 11px;
    color: var(--sb-muted);
}

.tpl-color {
    display: block;
    width: 100%;
    height: 32px;
    padding: 2px;
    background: #fff;
    border: 1px solid var(--sb-border);
    border-radius: var(--sb-radius);
    cursor: pointer;
}

.tpl-switch {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 !important;
    cursor: pointer;
}

.tpl-img {
    display: flex;
    gap: 6px;
}

.tpl-img .form-control {
    flex: 1;
    min-width: 0;
}

.tpl-vars {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.tpl-var {
    padding: 3px 8px;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 12px;
    color: var(--sb-brand-dark);
    background: var(--sb-brand-soft);
    border: 1px solid transparent;
    border-radius: 3px;
    cursor: pointer;
}

.tpl-var:hover {
    border-color: var(--sb-brand);
}

.tpl-var.is-custom {
    color: #5b21b6;
    background: #ede9fe;
}

/* Blocos */
.tpl-block {
    margin-bottom: 8px;
    background: var(--sb-surface);
    border: 1px solid var(--sb-border);
    border-radius: var(--sb-radius);
}

.tpl-block.is-open {
    border-color: var(--sb-brand);
}

.tpl-block__head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    cursor: pointer;
}

.tpl-block__head>i {
    width: 16px;
    text-align: center;
    color: var(--sb-brand-dark);
}

.tpl-block__head strong {
    font-size: 13px;
    white-space: nowrap;
}

.tpl-block__sum {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    font-size: 12px;
    color: var(--sb-muted);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tpl-block__tools {
    display: flex;
    gap: 2px;
    margin-left: auto;
}

.tpl-block__tools button {
    width: 26px;
    height: 26px;
    font-size: 11px;
    color: var(--sb-muted);
    background: none;
    border: 0;
    border-radius: 3px;
    cursor: pointer;
}

.tpl-block__tools button:hover:not(:disabled) {
    color: var(--sb-ink);
    background: var(--sb-bg);
}

.tpl-block__tools button[data-act="del"]:hover {
    color: var(--sb-danger);
    background: #fef2f2;
}

.tpl-block__tools button:disabled {
    opacity: .3;
    cursor: default;
}

.tpl-block__body {
    padding: 12px;
    border-top: 1px solid var(--sb-border);
}

.tpl-palette {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.tpl-palette button {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 10px 4px;
    font-size: 12px;
    color: var(--sb-ink-soft);
    background: var(--sb-surface);
    border: 1px solid var(--sb-border);
    border-radius: var(--sb-radius);
    cursor: pointer;
}

.tpl-palette button i {
    font-size: 16px;
    color: var(--sb-brand-dark);
}

.tpl-palette button:hover {
    border-color: var(--sb-brand);
    background: var(--sb-brand-soft);
}

.tpl-code {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 12.5px;
    line-height: 1.5;
    white-space: pre;
    overflow: auto;
}

/* Pré-visualização */
.tpl-preview {
    position: sticky;
    top: 76px;
}

.tpl-preview__bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.tpl-preview__size {
    font-size: 12px;
    color: var(--sb-muted);
}

.tpl-seg {
    display: inline-flex;
}

.tpl-seg button {
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 600;
    color: var(--sb-muted);
    background: var(--sb-surface);
    border: 1px solid var(--sb-border);
    cursor: pointer;
}

.tpl-seg button:first-child {
    border-radius: var(--sb-radius) 0 0 var(--sb-radius);
}

.tpl-seg button:last-child {
    border-radius: 0 var(--sb-radius) var(--sb-radius) 0;
    border-left: 0;
}

.tpl-seg button.is-active {
    color: #fff;
    background: var(--sb-ink);
    border-color: var(--sb-ink);
}

.tpl-frame {
    display: flex;
    justify-content: center;
    padding: 16px;
    background: #dfe2ea;
    border: 1px solid var(--sb-border);
    border-radius: var(--sb-radius);
}

.tpl-frame iframe {
    display: block;
    width: 100%;
    height: calc(100vh - 270px);
    min-height: 420px;
    background: #fff;
    border: 0;
}

.tpl-frame[data-device="mobile"] iframe {
    width: 375px;
    max-width: 100%;
    border-radius: 4px;
    box-shadow: 0 0 0 1px var(--sb-border);
}

#tplWarnings .alert {
    font-size: 12.5px;
    padding: 8px 12px;
}

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

    .tpl-mtabs {
        display: flex;
    }

    .tpl-side {
        max-height: none;
        overflow: visible;
        padding-right: 0;
    }

    .tpl-preview {
        position: static;
    }

    .tpl-frame iframe {
        height: 70vh;
    }

    .tpl-editor[data-pane="edit"] .tpl-preview {
        display: none;
    }

    .tpl-editor[data-pane="preview"] .tpl-side {
        display: none;
    }
}

@media (max-width: 575.98px) {
    .tpl-bar {
        flex-wrap: wrap;
    }

    .tpl-bar__name {
        order: 3;
        flex: 1 1 100%;
    }

    .tpl-bar__status {
        display: none;
    }

    .tpl-bar__actions {
        margin-left: auto;
    }

    .tpl-cards {
        grid-template-columns: 1fr;
    }

    .tpl-fields {
        grid-template-columns: 1fr;
    }

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

/* =====================================================================
   Editor visual (edição directa)
   ===================================================================== */
.tpl-preview__bar {
    flex-wrap: wrap;
    gap: 8px;
}

.tpl-preview__size {
    margin-left: auto;
}

.tpl-fmt {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
    padding: 6px 8px;
    background: var(--sb-surface);
    border: 1px solid var(--sb-border);
    border-radius: var(--sb-radius);
}

.tpl-fmt button {
    padding: 5px 10px;
    font-size: 13px;
    font-weight: 600;
    color: var(--sb-ink);
    background: var(--sb-surface);
    border: 1px solid var(--sb-border);
    border-radius: var(--sb-radius);
    cursor: pointer;
}

.tpl-fmt button:hover:not(:disabled) {
    background: var(--sb-brand-soft);
    border-color: var(--sb-brand);
}

.tpl-fmt button:disabled {
    opacity: .4;
    cursor: default;
}

.tpl-fmt__hint {
    margin-left: auto;
    font-size: 12px;
    color: var(--sb-muted);
}

.tpl-sel__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 12px;
}

.tpl-sel__head strong {
    font-size: 13px;
}

.tpl-sel__head strong i {
    margin-right: 6px;
    color: var(--sb-brand-dark);
}

.tpl-frame iframe {
    height: calc(100vh - 330px);
}

@media (max-width: 991.98px) {
    .tpl-frame iframe {
        height: 70vh;
    }

    .tpl-fmt__hint {
        display: none;
    }

    .tpl-fmt #btnTplOpts {
        margin-left: auto;
    }
}

/* =====================================================================
   Campanhas
   ===================================================================== */
.cmp-progress {
    height: 6px;
    overflow: hidden;
    background: var(--sb-bg);
    border-radius: 3px;
}

.cmp-progress span {
    display: block;
    height: 100%;
    background: var(--sb-brand);
}

/* Assistente */
.cmp-steps {
    display: flex;
    margin: 0 0 16px;
    padding: 0;
    list-style: none;
    background: var(--sb-surface);
    border: 1px solid var(--sb-border);
    border-radius: var(--sb-radius);
}

.cmp-steps li {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--sb-muted);
    border-bottom: 3px solid transparent;
}

.cmp-steps .n {
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    background: var(--sb-bg);
    border-radius: var(--sb-radius);
}

.cmp-steps li.is-active {
    color: var(--sb-ink);
    border-bottom-color: var(--sb-brand);
}

.cmp-steps li.is-active .n {
    color: #fff;
    background: var(--sb-ink);
}

.cmp-steps li.is-done {
    color: var(--sb-ink);
    cursor: pointer;
}

.cmp-steps li.is-done .n {
    color: #fff;
    background: var(--sb-success);
}

.cmp-nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 14px 20px;
    border-top: 1px solid var(--sb-border);
}

.cmp-nav__sp {
    flex: 1;
}

/* Cartões seleccionáveis (templates e listas) */
.cmp-pick {
    position: relative;
    display: flex;
    margin: 0;
    background: var(--sb-surface);
    border: 1px solid var(--sb-border);
    border-radius: var(--sb-radius);
    cursor: pointer;
    overflow: hidden;
}

.cmp-pick:hover {
    border-color: var(--sb-brand);
}

.cmp-pick.is-selected {
    border-color: var(--sb-brand-dark);
    box-shadow: 0 0 0 2px var(--sb-brand);
}

.cmp-pick input {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 2;
    width: 18px;
    height: 18px;
    accent-color: var(--sb-ink);
}

.cmp-pick__body {
    display: flex;
    flex-direction: column;
    min-width: 0;
    padding: 12px 14px;
}

.cmp-pick__body strong {
    font-size: 14px;
}

.cmp-pick__body span {
    font-size: 12px;
    color: var(--sb-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cmp-cards {
    padding: 0;
}

.cmp-tpl {
    flex-direction: column;
}

.cmp-tpl .tpl-thumb {
    height: 240px;
}

.cmp-picks {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 10px;
}

.cmp-list .cmp-pick__body {
    padding-left: 40px;
}

.cmp-counts {
    margin-top: 16px;
    padding: 12px 14px;
    font-size: 14px;
    background: var(--sb-brand-soft);
    border-radius: var(--sb-radius);
}

.cmp-counts:empty {
    display: none;
}

.cmp-counts small {
    display: block;
    margin-top: 2px;
    color: var(--sb-muted);
}

@media (max-width: 575.98px) {
    .cmp-steps li {
        padding: 10px 4px;
    }

    .cmp-steps li .t {
        display: none;
    }

    .cmp-steps li.is-active .t {
        display: inline;
    }

    .cmp-nav {
        padding: 12px 16px;
    }

    .cmp-nav .sb-btn {
        flex: 1 1 100%;
    }

    .cmp-nav__sp {
        display: none;
    }
}

/* =====================================================================
   Envio direto
   ===================================================================== */
.snd-search {
    position: relative;
}

.snd-results {
    position: absolute;
    top: calc(100% + 2px);
    left: 0;
    right: 0;
    z-index: 20;
    max-height: 240px;
    overflow-y: auto;
    background: var(--sb-surface);
    border: 1px solid var(--sb-border);
    border-radius: var(--sb-radius);
    box-shadow: 0 8px 24px rgba(18, 4, 31, .12);
}

.snd-results button {
    display: flex;
    flex-direction: column;
    width: 100%;
    padding: 8px 12px;
    text-align: left;
    background: none;
    border: 0;
    border-bottom: 1px solid var(--sb-border);
    cursor: pointer;
}

.snd-results button:last-child {
    border-bottom: 0;
}

.snd-results button:hover {
    background: var(--sb-brand-soft);
}

.snd-results strong {
    font-size: 13px;
}

.snd-results span {
    font-size: 12px;
    color: var(--sb-muted);
}

.snd-results__none {
    padding: 10px 12px;
    font-size: 13px;
    color: var(--sb-muted);
}

.snd-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.snd-chips:empty {
    display: none;
}

.snd-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: 100%;
    padding: 3px 4px 3px 9px;
    font-size: 12px;
    background: var(--sb-bg);
    border: 1px solid var(--sb-border);
    border-radius: var(--sb-radius);
}

.snd-chip button {
    padding: 0 6px;
    font-size: 16px;
    line-height: 1;
    color: var(--sb-muted);
    background: none;
    border: 0;
    cursor: pointer;
}

.snd-chip button:hover {
    color: var(--sb-danger);
}

.snd-fmt {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 6px;
}

.snd-fmt button {
    padding: 4px 10px;
    font-size: 13px;
    font-weight: 600;
    color: var(--sb-ink);
    background: var(--sb-surface);
    border: 1px solid var(--sb-border);
    border-radius: var(--sb-radius);
    cursor: pointer;
}

.snd-fmt button:hover {
    background: var(--sb-brand-soft);
    border-color: var(--sb-brand);
}

.snd-fmt .tpl-help {
    margin: 0 0 0 auto;
}

.snd-rich {
    min-height: 150px;
    max-height: 340px;
    overflow-y: auto;
    padding: 10px 12px;
    font-size: 14px;
    line-height: 1.6;
    background: #fff;
    border: 1px solid var(--sb-border);
    border-radius: var(--sb-radius);
    outline: none;
    white-space: pre-wrap;
    word-break: break-word;
}

.snd-rich:focus {
    border-color: var(--sb-brand);
    box-shadow: 0 0 0 2px var(--sb-brand-soft);
}

.snd-rich:empty::before {
    content: attr(data-placeholder);
    color: var(--sb-muted);
}

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

.snd-actions .sb-btn {
    flex: 1 1 140px;
}

.tpl-frame iframe {
    height: calc(100vh - 280px);
}

/* Progresso */
.snd-progress {
    max-width: 640px;
    margin: 0 auto;
    padding: 32px 20px;
    text-align: center;
}

.snd-bar {
    height: 10px;
    margin: 18px 0;
}

.snd-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 18px;
}

.snd-stats>div {
    padding: 12px;
    background: var(--sb-bg);
    border-radius: var(--sb-radius);
}

.snd-stats b {
    display: block;
    font-size: 24px;
    line-height: 1.1;
}

.snd-stats small {
    color: var(--sb-muted);
}

.snd-prog-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-top: 8px;
}

@media (max-width: 991.98px) {
    .tpl-frame iframe {
        height: 70vh;
    }
}

@media (max-width: 575.98px) {
    .snd-fmt .tpl-help {
        display: none;
    }

    .snd-prog-actions .sb-btn {
        flex: 1 1 100%;
    }
}

/* =====================================================================
   Editor: separadores, barra de ferramentas do elemento, colunas
   ===================================================================== */
.tpl-tabs {
    position: sticky;
    top: 0;
    z-index: 5;
    display: flex;
    gap: 2px;
    margin-bottom: 10px;
    padding-bottom: 8px;
    overflow-x: auto;
    background: var(--sb-bg);
    border-bottom: 1px solid var(--sb-border);
}

.tpl-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    color: var(--sb-muted);
    background: none;
    border: 0;
    border-bottom: 3px solid transparent;
    cursor: pointer;
}

.tpl-tab:hover {
    color: var(--sb-ink);
}

.tpl-tab.is-active {
    color: var(--sb-ink);
    border-bottom-color: var(--sb-brand);
}

.tpl-tab i {
    color: var(--sb-brand-dark);
}

.tpl-side>.snd-actions {
    position: static;
    margin-bottom: 10px;
}

/* Barra de ferramentas do elemento (sempre à vista, junto ao e-mail) */
.tpl-ctx {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px 10px;
    min-height: 44px;
    margin-bottom: 8px;
    padding: 6px 10px;
    background: var(--sb-ink);
    color: #fff;
    border-radius: var(--sb-radius);
}

.tpl-ctx__hint {
    font-size: 13px;
    color: #cfc6dc;
}

.tpl-ctx__hint i {
    margin-right: 6px;
    color: var(--sb-brand);
}

.tpl-ctx__name {
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
}

.tpl-ctx__name i {
    margin-right: 6px;
    color: var(--sb-brand);
}

.tpl-ctx__group {
    display: inline-flex;
    gap: 2px;
    padding: 2px;
    background: rgba(255, 255, 255, .1);
    border-radius: var(--sb-radius);
}

.tpl-ctx button {
    min-width: 30px;
    height: 28px;
    padding: 0 8px;
    font-size: 12px;
    color: #fff;
    background: none;
    border: 0;
    border-radius: 3px;
    cursor: pointer;
}

.tpl-ctx button:hover:not(:disabled) {
    background: var(--sb-brand-dark);
}

.tpl-ctx button.is-on {
    background: var(--sb-brand-dark);
}

.tpl-ctx button.is-danger:hover {
    background: var(--sb-danger);
}

.tpl-ctx button:disabled {
    opacity: .35;
    cursor: default;
}

.tpl-ctx__txt {
    font-weight: 600;
    background: rgba(255, 255, 255, .1) !important;
}

.tpl-ctx__opts {
    margin-left: auto;
}

/* Colunas no painel */
.tpl-colbox {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 14px;
}

.tpl-colbox__col {
    padding: 10px;
    background: var(--sb-bg);
    border: 1px solid var(--sb-border);
    border-radius: var(--sb-radius);
}

.tpl-colbox__title {
    margin-bottom: 6px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--sb-muted);
}

.tpl-colbox__item {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    margin-bottom: 4px;
    padding: 5px 8px;
    font-size: 12px;
    text-align: left;
    background: var(--sb-surface);
    border: 1px solid var(--sb-border);
    border-radius: var(--sb-radius);
    cursor: pointer;
}

.tpl-colbox__item:hover {
    border-color: var(--sb-brand);
}

.tpl-colbox__item i {
    color: var(--sb-brand-dark);
}

.tpl-colbox__empty {
    font-size: 12px;
    color: var(--sb-muted);
}

.tpl-addinfo {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
    padding: 8px 10px;
    font-size: 13px;
    background: var(--sb-brand-soft);
    border-radius: var(--sb-radius);
}

.tpl-palette button:disabled {
    opacity: .4;
    cursor: not-allowed;
}

@media (max-width: 991.98px) {
    .tpl-ctx__opts {
        margin-left: 0;
    }
}

@media (max-width: 575.98px) {
    .tpl-colbox {
        grid-template-columns: 1fr;
    }

    .tpl-tab {
        padding: 8px 9px;
    }
}

/* =====================================================================
   Criar conta
   ===================================================================== */
.reg-page {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
    background: var(--sb-bg);
}

.reg-aside {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 32px;
    padding: 44px 52px;
    color: #fff;
    background:
        linear-gradient(rgba(255, 255, 255, .04) 1px, transparent 1px) 0 0 / 36px 36px,
        linear-gradient(90deg, rgba(255, 255, 255, .04) 1px, transparent 1px) 0 0 / 36px 36px,
        linear-gradient(160deg, #12041f 0%, #2a0f45 100%);
    border-top: 3px solid var(--sb-brand);
}

.reg-logo {
    display: inline-block;
    align-self: flex-start;
    padding: 10px 14px;
    background: #fff;
    border-radius: var(--sb-radius);
}

.reg-logo img {
    display: block;
    height: 28px;
    width: auto;
}

.reg-logo--mobile {
    display: none;
    padding: 0;
    background: none;
    margin-bottom: 20px;
}

.reg-eyebrow {
    margin: 0 0 10px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--sb-brand);
}

.reg-title {
    margin: 0 0 32px;
    font-size: 32px;
    line-height: 1.2;
    font-weight: 700;
    letter-spacing: -.02em;
}

.reg-benefits {
    display: grid;
    gap: 18px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.reg-benefits li {
    display: flex;
    gap: 14px;
}

.reg-benefits li>i {
    flex: 0 0 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--sb-brand);
    background: rgba(76, 195, 241, .12);
    border: 1px solid rgba(76, 195, 241, .3);
    border-radius: var(--sb-radius);
}

.reg-benefits strong {
    display: block;
    font-size: 15px;
}

.reg-benefits span {
    font-size: 13px;
    color: #b9aecb;
}

.reg-aside__foot {
    margin: 0;
    font-size: 12px;
    color: #8f82a3;
}

.reg-main {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
}

.reg-card {
    width: 100%;
    max-width: 500px;
    padding: 36px;
    background: var(--sb-surface);
    border: 1px solid var(--sb-border);
    border-radius: var(--sb-radius);
    box-shadow: 0 12px 40px rgba(18, 4, 31, .08);
}

.reg-card__title {
    margin: 0;
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -.01em;
}

.reg-card__sub {
    margin: 4px 0 22px;
    color: var(--sb-muted);
}

.reg-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 14px;
}

.reg-field {
    margin-bottom: 14px;
}

.reg-field label {
    display: block;
    margin-bottom: 5px;
    font-size: 13px;
    font-weight: 600;
    color: var(--sb-ink-soft);
}

.reg-field label span {
    font-weight: 400;
    color: var(--sb-muted);
}

.reg-input {
    position: relative;
    display: flex;
    align-items: center;
    background: #fff;
    border: 1px solid var(--sb-border);
    border-radius: var(--sb-radius);
    transition: border-color .15s, box-shadow .15s;
}

.reg-input:focus-within {
    border-color: var(--sb-brand-dark);
    box-shadow: 0 0 0 3px var(--sb-brand-soft);
}

.reg-input.has-error {
    border-color: var(--sb-danger);
}

.reg-input>i {
    width: 40px;
    text-align: center;
    font-size: 13px;
    color: var(--sb-muted);
}

.reg-input input {
    flex: 1;
    min-width: 0;
    height: 42px;
    padding: 0 12px 0 0;
    font-size: 14px;
    color: var(--sb-ink);
    background: transparent;
    border: 0;
    outline: 0;
}

.reg-eye {
    width: 40px;
    height: 42px;
    color: var(--sb-muted);
    background: none;
    border: 0;
    cursor: pointer;
}

.reg-eye:hover {
    color: var(--sb-ink);
}

.reg-eye i {
    width: auto;
}

.reg-error {
    display: block;
    min-height: 0;
    margin-top: 4px;
    font-size: 12px;
    color: var(--sb-danger);
}

.reg-error:empty {
    display: none;
}

.reg-hint {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    color: var(--sb-muted);
}

.reg-strength {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
    margin-top: 8px;
}

.reg-strength span {
    height: 4px;
    background: var(--sb-border);
    border-radius: 2px;
    transition: background .2s;
}

.reg-strength[data-level="1"] span:nth-child(-n+1) {
    background: var(--sb-danger);
}

.reg-strength[data-level="2"] span:nth-child(-n+2) {
    background: var(--sb-warning);
}

.reg-strength[data-level="3"] span:nth-child(-n+3) {
    background: var(--sb-brand);
}

.reg-strength[data-level="4"] span {
    background: var(--sb-success);
}

.reg-trap {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.reg-check {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    margin: 4px 0 0;
    font-size: 13px;
    color: var(--sb-ink-soft);
    cursor: pointer;
}

.reg-check input {
    flex: 0 0 auto;
    width: 17px;
    height: 17px;
    margin-top: 2px;
    accent-color: var(--sb-ink);
}

.reg-submit {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    height: 46px;
    margin-top: 18px;
    font-size: 15px;
    font-weight: 700;
    color: #fff;
    background: var(--sb-ink);
    border: 0;
    border-radius: var(--sb-radius);
    cursor: pointer;
    transition: background .15s;
}

.reg-submit:hover:not(:disabled) {
    background: var(--sb-brand-dark);
}

.reg-submit:disabled {
    opacity: .7;
    cursor: default;
}

.reg-login {
    margin: 20px 0 0;
    text-align: center;
    font-size: 14px;
    color: var(--sb-muted);
}

.reg-login a {
    font-weight: 600;
    color: var(--sb-brand-dark);
}

@media (max-width: 991.98px) {
    .reg-page {
        grid-template-columns: 1fr;
    }

    .reg-aside {
        display: none;
    }

    .reg-logo--mobile {
        display: inline-block;
    }

    .reg-main {
        align-items: flex-start;
        padding: 24px 16px;
    }

    .reg-card {
        padding: 24px 20px;
        box-shadow: none;
    }
}

@media (max-width: 575.98px) {
    .reg-row {
        grid-template-columns: 1fr;
    }
}

/* =====================================================================
   Criar conta: painel da marca em versão clara
   ===================================================================== */
.reg-aside {
    color: var(--sb-ink);
    background:
        radial-gradient(circle at 12% 8%, rgba(76, 195, 241, .22) 0, transparent 45%),
        radial-gradient(circle at 90% 95%, rgba(76, 195, 241, .16) 0, transparent 40%),
        linear-gradient(rgba(18, 4, 31, .035) 1px, transparent 1px) 0 0 / 36px 36px,
        linear-gradient(90deg, rgba(18, 4, 31, .035) 1px, transparent 1px) 0 0 / 36px 36px,
        linear-gradient(160deg, #f3fbfe 0%, #e8f7fd 100%);
    border-top: 3px solid var(--sb-brand);
    border-right: 1px solid var(--sb-border);
}

.reg-aside .reg-logo {
    padding: 0;
    background: none;
}

.reg-eyebrow {
    color: var(--sb-brand-dark);
}

.reg-title {
    color: var(--sb-ink);
}

.reg-benefits li>i {
    color: var(--sb-brand-dark);
    background: #fff;
    border: 1px solid #cfeaf6;
    box-shadow: 0 2px 8px rgba(21, 151, 201, .12);
}

.reg-benefits strong {
    color: var(--sb-ink);
}

.reg-benefits span {
    color: var(--sb-muted);
}

.reg-aside__foot {
    color: var(--sb-muted);
}

/* =====================================================================
   Criar conta: painel compacto (sem scroll no PC)
   ===================================================================== */
@media (min-width: 992px) {
    .reg-page {
        height: 100vh;
        min-height: 0;
    }

    .reg-aside {
        height: 100vh;
        padding: 24px 44px;
        gap: 12px;
        overflow: hidden;
    }

    .reg-aside .reg-logo img {
        height: 24px;
    }

    .reg-eyebrow {
        margin-bottom: 6px;
        font-size: 11px;
    }

    .reg-title {
        margin-bottom: 16px;
        font-size: 26px;
        line-height: 1.15;
    }

    .reg-benefits {
        gap: 12px;
    }

    .reg-benefits li {
        gap: 12px;
    }

    .reg-benefits li>i {
        flex-basis: 34px;
        height: 34px;
        font-size: 14px;
    }

    .reg-benefits strong {
        font-size: 14px;
    }

    .reg-benefits span {
        font-size: 12.5px;
        line-height: 1.35;
    }

    .reg-aside__foot {
        font-size: 11px;
    }

    /* O formulário também fica dentro do ecrã */
    .reg-main {
        height: 100vh;
        padding: 16px 24px;
        overflow-y: auto;
    }

    .reg-card {
        padding: 26px 30px;
        margin: auto;
    }

    .reg-card__sub {
        margin-bottom: 14px;
    }

    .reg-field {
        margin-bottom: 10px;
    }

    .reg-input input {
        height: 38px;
    }

    .reg-submit {
        height: 42px;
        margin-top: 12px;
    }

    .reg-login {
        margin-top: 14px;
    }
}

/* Ecrãs baixos (portáteis pequenos): aperta ainda mais */
@media (min-width: 992px) and (max-height: 760px) {
    .reg-aside {
        padding: 18px 40px;
        gap: 8px;
    }

    .reg-title {
        margin-bottom: 12px;
        font-size: 22px;
    }

    .reg-benefits {
        gap: 9px;
    }

    .reg-benefits span {
        display: none;
    }

    .reg-card {
        padding: 20px 26px;
    }

    .reg-card__title {
        font-size: 21px;
    }

    .reg-card__sub {
        margin: 2px 0 10px;
        font-size: 13px;
    }

    .reg-field {
        margin-bottom: 8px;
    }

    .reg-check {
        font-size: 12px;
    }
}

/* =====================================================================
   Ligações no registo, verificação do e-mail e páginas legais
   ===================================================================== */
.reg-check a {
    font-weight: 600;
    color: var(--sb-brand-dark);
    text-decoration: underline;
}

/* ---------- Verificação do e-mail ---------- */
.ver-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    background:
        radial-gradient(circle at 12% 8%, rgba(76, 195, 241, .2) 0, transparent 45%),
        radial-gradient(circle at 90% 95%, rgba(76, 195, 241, .14) 0, transparent 40%),
        var(--sb-bg);
}

.ver-card {
    width: 100%;
    max-width: 460px;
    padding: 36px 32px 28px;
    text-align: center;
    background: var(--sb-surface);
    border: 1px solid var(--sb-border);
    border-top: 3px solid var(--sb-brand);
    border-radius: var(--sb-radius);
    box-shadow: 0 12px 40px rgba(18, 4, 31, .08);
}

.ver-logo {
    display: inline-block;
    margin-bottom: 22px;
}

.ver-logo img {
    display: block;
    height: 28px;
    width: auto;
}

.ver-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    color: var(--sb-brand-dark);
    background: var(--sb-brand-soft);
    border-radius: var(--sb-radius);
}

.ver-title {
    margin: 0 0 6px;
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -.01em;
}

.ver-sub {
    margin: 0 0 22px;
    color: var(--sb-muted);
}

.ver-sub strong {
    color: var(--sb-ink);
}

.ver-boxes {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 14px;
}

.ver-box {
    width: 52px;
    height: 62px;
    padding: 0;
    text-align: center;
    font-size: 26px;
    font-weight: 700;
    color: var(--sb-ink);
    background: #fff;
    border: 1px solid var(--sb-border);
    border-radius: var(--sb-radius);
    outline: 0;
    transition: border-color .15s, box-shadow .15s;
}

.ver-box:focus {
    border-color: var(--sb-brand-dark);
    box-shadow: 0 0 0 3px var(--sb-brand-soft);
}

.ver-box.has-error {
    border-color: var(--sb-danger);
    animation: ver-shake .35s;
}

@keyframes ver-shake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-5px);
    }

    75% {
        transform: translateX(5px);
    }
}

.ver-timer {
    margin: 0 0 16px;
    font-size: 14px;
    color: var(--sb-muted);
}

.ver-timer strong {
    color: var(--sb-ink);
    font-variant-numeric: tabular-nums;
}

.ver-timer.is-expired {
    color: var(--sb-danger);
}

.ver-submit {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    height: 46px;
    font-size: 15px;
    font-weight: 700;
    color: #fff;
    background: var(--sb-ink);
    border: 0;
    border-radius: var(--sb-radius);
    cursor: pointer;
    transition: background .15s;
}

.ver-submit:hover:not(:disabled) {
    background: var(--sb-brand-dark);
}

.ver-submit:disabled {
    opacity: .55;
    cursor: default;
}

.ver-resend {
    margin: 18px 0 4px;
    font-size: 14px;
    color: var(--sb-muted);
}

.ver-resend button {
    padding: 0;
    font-weight: 600;
    color: var(--sb-brand-dark);
    background: none;
    border: 0;
    cursor: pointer;
}

.ver-resend button:disabled {
    color: var(--sb-muted);
    cursor: default;
}

.ver-note {
    margin: 0 0 18px;
    font-size: 12px;
    color: var(--sb-muted);
}

.ver-back {
    font-size: 13px;
    color: var(--sb-muted);
    text-decoration: none;
}

.ver-back:hover {
    color: var(--sb-ink);
}

@media (max-width: 420px) {
    .ver-card {
        padding: 28px 18px 22px;
    }

    .ver-boxes {
        gap: 6px;
    }

    .ver-box {
        width: 42px;
        height: 54px;
        font-size: 22px;
    }
}

/* ---------- Termos e Privacidade ---------- */
.legal-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--sb-bg);
}

.legal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    padding: 14px 24px;
    background: var(--sb-surface);
    border-top: 3px solid var(--sb-brand);
    border-bottom: 1px solid var(--sb-border);
}

.legal-logo img {
    display: block;
    height: 26px;
    width: auto;
}

.legal-nav {
    display: flex;
    gap: 18px;
}

.legal-nav a {
    padding: 6px 0;
    font-size: 14px;
    font-weight: 500;
    color: var(--sb-muted);
    text-decoration: none;
    border-bottom: 2px solid transparent;
}

.legal-nav a:hover {
    color: var(--sb-ink);
}

.legal-nav a.active {
    font-weight: 600;
    color: var(--sb-ink);
    border-bottom-color: var(--sb-brand);
}

.legal-main {
    flex: 1;
    padding: 32px 16px 48px;
}

.legal-doc {
    max-width: 820px;
    margin: 0 auto;
    padding: 36px 40px;
    background: var(--sb-surface);
    border: 1px solid var(--sb-border);
    border-radius: var(--sb-radius);
    line-height: 1.7;
    color: var(--sb-ink-soft);
}

.legal-doc h1 {
    margin: 0 0 4px;
    font-size: 28px;
    font-weight: 700;
    color: var(--sb-ink);
    letter-spacing: -.01em;
}

.legal-meta {
    margin: 0 0 24px;
    font-size: 13px;
    color: var(--sb-muted);
}

.legal-doc h2 {
    margin: 30px 0 8px;
    font-size: 18px;
    font-weight: 700;
    color: var(--sb-ink);
}

.legal-doc h3 {
    margin: 16px 0 6px;
    font-size: 15px;
    font-weight: 700;
    color: var(--sb-ink);
}

.legal-doc p {
    margin: 0 0 12px;
}

.legal-doc ul {
    margin: 0 0 14px;
    padding-left: 22px;
}

.legal-doc li {
    margin-bottom: 6px;
}

.legal-doc a {
    color: var(--sb-brand-dark);
}

.legal-foot {
    padding: 20px 16px;
    text-align: center;
    font-size: 12px;
    line-height: 1.7;
    color: var(--sb-muted);
}

@media (max-width: 575.98px) {
    .legal-doc {
        padding: 24px 18px;
    }

    .legal-doc h1 {
        font-size: 24px;
    }

    .legal-head {
        padding: 12px 16px;
    }
}

/* =====================================================================
   Recuperar senha (reaproveita o cartão da verificação do e-mail)
   ===================================================================== */
.ver-form .reg-field {
    text-align: left;
}

.ver-form .ver-submit {
    margin-top: 6px;
}

.ver-center {
    margin-top: 16px;
    text-align: center;
}

/* =====================================================================
   Contactos: cabeçalho, filtros e confirmações
   ===================================================================== */
.ct-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--sb-border);
}

.ct-head__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.ct-filters {
    padding: 14px 20px 16px;
    background: var(--sb-bg);
    border-bottom: 1px solid var(--sb-border);
}

.ct-search {
    position: relative;
    margin-bottom: 12px;
}

.ct-search i {
    position: absolute;
    top: 50%;
    left: 14px;
    transform: translateY(-50%);
    font-size: 14px;
    color: var(--sb-muted);
    pointer-events: none;
}

.ct-search input {
    height: 42px;
    padding-left: 38px;
    background: #fff;
}

.ct-filters__grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
    gap: 12px;
    align-items: end;
}

.ct-filter label {
    display: block;
    margin-bottom: 4px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--sb-muted);
}

.ct-filter .form-select {
    background-color: #fff;
}

.cf-total {
    display: flex;
    align-items: baseline;
    gap: 10px;
    padding: 14px 16px;
    background: var(--sb-brand-soft);
    border-radius: var(--sb-radius);
}

.cf-total b {
    font-size: 30px;
    line-height: 1;
    color: var(--sb-ink);
}

.cf-total span {
    color: var(--sb-ink-soft);
}

/* =====================================================================
   Importar CSV: ficheiro, associação e pré-visualização
   ===================================================================== */
.imp-drop {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 0;
    padding: 22px 20px;
    background: var(--sb-bg);
    border: 2px dashed #b8bfcc;
    border-radius: var(--sb-radius);
    cursor: pointer;
    transition: border-color .15s, background .15s;
}

.imp-drop:hover {
    border-color: var(--sb-brand-dark);
    background: var(--sb-brand-soft);
}

.imp-drop>i {
    font-size: 30px;
    color: var(--sb-brand-dark);
}

.imp-drop span {
    display: flex;
    flex-direction: column;
}

.imp-drop small {
    color: var(--sb-muted);
}

.imp-file {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px 16px;
    padding: 12px 16px;
    background: var(--sb-bg);
    border: 1px solid var(--sb-border);
    border-radius: var(--sb-radius);
}

.imp-file>i {
    font-size: 22px;
    color: var(--sb-brand-dark);
}

.imp-file>div {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
}

.imp-file strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.imp-file span {
    font-size: 12px;
    color: var(--sb-muted);
}

.imp-file__header {
    margin: 0;
    font-size: 13px;
}

.imp-title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 26px 0 12px;
    font-size: 15px;
    font-weight: 700;
}

.imp-title span {
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: #fff;
    background: var(--sb-ink);
    border-radius: var(--sb-radius);
}

.imp-sample {
    display: inline-block;
    margin: 0 4px 4px 0;
    padding: 2px 8px;
    font-size: 12px;
    background: var(--sb-bg);
    border: 1px solid var(--sb-border);
    border-radius: 3px;
}

.imp-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 12px;
}

.imp-stat {
    padding: 10px 14px;
    background: var(--sb-bg);
    border: 1px solid var(--sb-border);
    border-radius: var(--sb-radius);
}

.imp-stat b {
    display: block;
    font-size: 22px;
    line-height: 1.1;
}

.imp-stat span {
    font-size: 12px;
    color: var(--sb-muted);
}

.imp-stat--ok {
    background: #ecfdf3;
    border-color: #bbf0cf;
}

.imp-stat--ok b {
    color: var(--sb-success);
}

.imp-stat--bad {
    background: #fef2f2;
    border-color: #fecaca;
}

.imp-stat--bad b {
    color: var(--sb-danger);
}

.imp-stat--warn {
    background: #fffbeb;
    border-color: #fde68a;
}

.imp-stat--warn b {
    color: var(--sb-warning);
}

.imp-preview td {
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.imp-preview tr.is-bad td {
    background: #fffafa;
}

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

    .ct-filter--clear {
        grid-column: 1 / -1;
    }

    .ct-filter--clear .sb-btn {
        width: 100%;
    }
}

@media (max-width: 575.98px) {
    .ct-head {
        padding: 14px 16px;
    }

    .ct-head__actions {
        width: 100%;
    }

    .ct-head__actions .sb-btn {
        flex: 1;
    }

    .ct-filters {
        padding: 12px 16px 14px;
    }

    .ct-filters__grid {
        grid-template-columns: 1fr;
    }

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

    .imp-file__header {
        width: 100%;
    }
}

/* =====================================================================
   Relatórios
   ===================================================================== */
.rpt-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.rpt-tools {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

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

.rpt-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 18px;
    background: var(--sb-surface);
    border: 1px solid var(--sb-border);
    border-radius: var(--sb-radius);
}

.rpt-card>i {
    flex: 0 0 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--sb-brand-dark);
    background: var(--sb-brand-soft);
    border-radius: var(--sb-radius);
}

.rpt-card b {
    display: block;
    font-size: 26px;
    line-height: 1.1;
}

.rpt-card span {
    font-size: 13px;
    color: var(--sb-muted);
}

.rpt-card.is-ok>i {
    color: var(--sb-success);
    background: #ecfdf3;
}

.rpt-card.is-bad>i {
    color: var(--sb-danger);
    background: #fef2f2;
}

.rpt-card.is-warn>i {
    color: var(--sb-warning);
    background: #fffbeb;
}

.rpt-bars {
    display: flex;
    align-items: flex-end;
    gap: 3px;
    height: 180px;
    padding-bottom: 2px;
    border-bottom: 1px solid var(--sb-border);
}

.rpt-bar {
    flex: 1;
    min-width: 2px;
    height: 100%;
    display: flex;
    align-items: flex-end;
}

.rpt-bar span {
    display: block;
    width: 100%;
    background: var(--sb-brand);
    border-radius: 2px 2px 0 0;
}

.rpt-bar:hover span {
    background: var(--sb-brand-dark);
}

.rpt-axis {
    display: flex;
    justify-content: space-between;
    margin-top: 6px;
    font-size: 12px;
    color: var(--sb-muted);
}

.rpt-error {
    display: flex;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid var(--sb-border);
}

.rpt-error:last-child {
    border-bottom: 0;
}

.rpt-error b {
    flex: 0 0 auto;
    min-width: 32px;
    color: var(--sb-danger);
}

.rpt-error span {
    font-size: 13px;
    color: var(--sb-ink-soft);
    word-break: break-word;
}

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

@media (max-width: 575.98px) {
    .rpt-cards {
        grid-template-columns: 1fr;
    }

    .rpt-tools {
        width: 100%;
    }

    .rpt-tools .sb-btn {
        flex: 1;
    }
}

/* Dashboard: atalhos */
.dash-actions {
    display: grid;
    gap: 10px;
}

.dash-actions .sb-btn {
    justify-content: flex-start;
}

/* =====================================================================
   Barra lateral (rail) e Notas
   ===================================================================== */
.sb-rail {
    display: none;
}

.sb-nav__list li.sb-mobile-only {
    display: none;
}

@media (min-width: 992px) {
    .sb-rail {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 4px;
        position: fixed;
        top: 64px;
        left: 0;
        bottom: 0;
        width: 64px;
        padding: 10px 0;
        background: var(--sb-surface);
        border-right: 1px solid var(--sb-border);
        z-index: 1020;
    }

    body:has(.sb-rail) .sb-main {
        padding-left: 64px;
        box-sizing: border-box;
    }
}

@media (max-width: 991.98px) {
    .sb-nav__list li.sb-mobile-only {
        display: block;
        order: 99;
    }
}

.sb-rail__item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    width: 52px;
    padding: 8px 0;
    font-size: 10px;
    font-weight: 600;
    color: var(--sb-muted);
    text-decoration: none;
    border-radius: var(--sb-radius);
}

.sb-rail__item i {
    font-size: 17px;
}

.sb-rail__item:hover {
    color: var(--sb-ink);
    background: var(--sb-bg);
}

.sb-rail__item.active {
    color: var(--sb-ink);
    background: var(--sb-brand-soft);
}

.sb-rail__item.active i {
    color: var(--sb-brand-dark);
}

/* ---------- Notas ---------- */
.nt-layout {
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr);
    gap: 16px;
    height: calc(100vh - 150px);
    min-height: 520px;
}

.nt-list,
.nt-editor {
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.nt-list__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px 8px;
}

.nt-list__title {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
}

.nt-list__search {
    position: relative;
    padding: 0 16px 10px;
}

.nt-list__search i {
    position: absolute;
    top: 50%;
    left: 28px;
    transform: translateY(-65%);
    font-size: 12px;
    color: var(--sb-muted);
}

.nt-list__search input {
    padding-left: 32px;
}

.nt-list__items {
    flex: 1;
    overflow-y: auto;
    border-top: 1px solid var(--sb-border);
}

.nt-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    width: 100%;
    padding: 12px 16px;
    text-align: left;
    background: none;
    border: 0;
    border-bottom: 1px solid var(--sb-border);
    cursor: pointer;
}

.nt-item:hover {
    background: var(--sb-bg);
}

.nt-item.is-active {
    background: var(--sb-brand-soft);
    box-shadow: inset 3px 0 0 var(--sb-brand);
}

.nt-item strong {
    font-size: 14px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nt-item span {
    font-size: 12.5px;
    color: var(--sb-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nt-item small {
    font-size: 11px;
    color: var(--sb-muted);
}

.nt-none {
    padding: 18px 16px;
    font-size: 13px;
    color: var(--sb-muted);
}

.nt-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: var(--sb-muted);
}

.nt-empty i {
    font-size: 34px;
    color: var(--sb-brand);
}

.nt-empty[hidden],
.nt-pane[hidden] {
    display: none;
}

.nt-pane {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.nt-top {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--sb-border);
}

.nt-back {
    display: none;
}

.nt-title {
    flex: 1;
    min-width: 0;
    font-size: 20px;
    font-weight: 700;
    color: var(--sb-ink);
    background: transparent;
    border: 0;
    outline: 0;
}

.nt-status {
    font-size: 12px;
    color: var(--sb-muted);
    white-space: nowrap;
}

.nt-status.is-dirty {
    color: var(--sb-warning);
}

.nt-tabs {
    display: flex;
    gap: 2px;
    padding: 0 12px;
    border-bottom: 1px solid var(--sb-border);
}

.nt-tabs button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 12px;
    font-size: 13px;
    font-weight: 600;
    color: var(--sb-muted);
    background: none;
    border: 0;
    border-bottom: 3px solid transparent;
    cursor: pointer;
}

.nt-tabs button.is-active {
    color: var(--sb-ink);
    border-bottom-color: var(--sb-brand);
}

.nt-tabs b {
    padding: 1px 7px;
    font-size: 11px;
    color: var(--sb-brand-dark);
    background: var(--sb-brand-soft);
    border-radius: 10px;
}

.nt-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.nt-panel[hidden] {
    display: none;
}

.nt-toolbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 2px;
    padding: 8px 12px;
    background: var(--sb-bg);
    border-bottom: 1px solid var(--sb-border);
}

.nt-toolbar select {
    width: auto;
    margin-right: 4px;
}

.nt-toolbar button {
    min-width: 32px;
    height: 30px;
    font-size: 13px;
    color: var(--sb-ink-soft);
    background: none;
    border: 0;
    border-radius: 3px;
    cursor: pointer;
}

.nt-toolbar button:hover {
    background: #fff;
    color: var(--sb-ink);
}

.nt-toolbar button.is-on {
    background: var(--sb-brand-soft);
    color: var(--sb-brand-dark);
}

.nt-sep {
    width: 1px;
    height: 20px;
    margin: 0 6px;
    background: var(--sb-border);
}

.nt-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px 24px;
    font-size: 15px;
    line-height: 1.7;
    color: var(--sb-ink-soft);
    outline: 0;
    word-break: break-word;
}

.nt-body:empty::before {
    content: attr(data-placeholder);
    color: var(--sb-muted);
}

.nt-body h1 {
    font-size: 26px;
    font-weight: 700;
    margin: 14px 0 8px;
    color: var(--sb-ink);
}

.nt-body h2 {
    font-size: 21px;
    font-weight: 700;
    margin: 12px 0 6px;
    color: var(--sb-ink);
}

.nt-body h3 {
    font-size: 17px;
    font-weight: 700;
    margin: 10px 0 6px;
    color: var(--sb-ink);
}

.nt-body ul,
.nt-body ol {
    padding-left: 24px;
    margin: 6px 0;
}

.nt-body blockquote {
    margin: 8px 0;
    padding: 4px 14px;
    color: var(--sb-muted);
    border-left: 3px solid var(--sb-brand);
}

.nt-body hr {
    margin: 14px 0;
    border-color: var(--sb-border);
}

.nt-body a {
    color: var(--sb-brand-dark);
    text-decoration: underline;
}

.note-mention {
    display: inline-block;
    padding: 0 6px;
    font-weight: 600;
    color: var(--sb-brand-dark);
    background: var(--sb-brand-soft);
    border: 1px solid #cfeaf6;
    border-radius: 3px;
    white-space: nowrap;
    user-select: all;
}

.note-mention[data-gone] {
    color: var(--sb-muted);
    background: var(--sb-bg);
    border-color: var(--sb-border);
    text-decoration: line-through;
}

.nt-mentions {
    padding: 16px;
    overflow-y: auto;
}

.nt-mention {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    margin-bottom: 8px;
    background: var(--sb-surface);
    border: 1px solid var(--sb-border);
    border-radius: var(--sb-radius);
}

.nt-mention>i {
    flex: 0 0 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--sb-brand-dark);
    background: var(--sb-brand-soft);
    border-radius: var(--sb-radius);
}

.nt-mention>div {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.nt-mention strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nt-mention span {
    font-size: 12.5px;
    color: var(--sb-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nt-mention b {
    font-size: 12px;
    color: var(--sb-muted);
}

.nt-mention.is-gone {
    opacity: .7;
}

.nt-mention.is-gone>i {
    color: var(--sb-muted);
    background: var(--sb-bg);
}

.nt-suggest {
    position: fixed;
    z-index: 2000;
    width: 320px;
    max-width: calc(100vw - 24px);
    max-height: 280px;
    overflow-y: auto;
    background: var(--sb-surface);
    border: 1px solid var(--sb-border);
    border-radius: var(--sb-radius);
    box-shadow: 0 8px 24px rgba(18, 4, 31, .16);
}

.nt-suggest[hidden] {
    display: none;
}

.nt-suggest button {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px 12px;
    text-align: left;
    background: none;
    border: 0;
    border-bottom: 1px solid var(--sb-border);
    cursor: pointer;
}

.nt-suggest button:last-child {
    border-bottom: 0;
}

.nt-suggest button:hover,
.nt-suggest button.is-active {
    background: var(--sb-brand-soft);
}

.nt-suggest i {
    color: var(--sb-brand-dark);
}

.nt-suggest span {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.nt-suggest strong {
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nt-suggest small {
    font-size: 12px;
    color: var(--sb-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nt-suggest__none {
    padding: 12px;
    font-size: 13px;
    color: var(--sb-muted);
}

@media (max-width: 991.98px) {
    .nt-layout {
        grid-template-columns: 1fr;
        height: calc(100vh - 130px);
    }

    #notesRoot[data-view="list"] .nt-editor {
        display: none;
    }

    #notesRoot[data-view="editor"] .nt-list {
        display: none;
    }

    .nt-back {
        display: inline-flex;
    }

    .nt-body {
        padding: 16px;
    }
}

.sb-app {
    overflow-x: clip;
}

@media (max-width: 575.98px) {
    .nt-top {
        gap: 6px;
        padding: 10px 12px;
    }

    .nt-title {
        font-size: 17px;
    }

    .nt-status {
        display: none;
    }
}

/* Contactos: seleção e eliminação em massa */
.ct-check {
    width: 17px;
    height: 17px;
    accent-color: var(--sb-ink);
    cursor: pointer;
}

.sb-table tr.is-selected td {
    background: var(--sb-brand-soft);
}

.ct-bulk {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px 12px;
    padding: 10px 20px;
    font-size: 13px;
    background: var(--sb-brand-soft);
    border-bottom: 1px solid #cfeaf6;
}

.ct-bulk[hidden] {
    display: none;
}

.ct-bulk__sp {
    flex: 1;
}

.ct-bulk__link {
    padding: 0;
    font-weight: 600;
    color: var(--sb-brand-dark);
    text-decoration: underline;
    background: none;
    border: 0;
    cursor: pointer;
}

.sb-btn--danger-solid {
    background: var(--sb-danger);
    border-color: var(--sb-danger);
    color: #fff;
}

.sb-btn--danger-solid:hover {
    background: #b91c1c;
    border-color: #b91c1c;
    color: #fff;
}

@media (max-width: 575.98px) {
    .ct-bulk {
        padding: 10px 16px;
    }

    .ct-bulk__sp {
        display: none;
    }
}

/* Contactos: coluna "Listas" com largura limitada e quebra de linha */
.sb-table td.ct-lists {
    width: 220px;
    max-width: 220px;
    white-space: normal;
    word-break: break-word;
    overflow-wrap: anywhere;
    text-transform: none;
    font-size: 13px;
    line-height: 1.35;
}

.ct-lists__text {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* A coluna do botão nunca é empurrada para fora */
.sb-table td:last-child {
    white-space: nowrap;
    width: 1%;
}

/* =====================================================================
   Lixeira: aspecto de "área de eliminados" (âmbar, discreto)
   ===================================================================== */


.trash-banner {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    margin-bottom: 16px;
    padding: 12px 16px;
    font-size: 13.5px;
    color: #78350f;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-left: 4px solid #f59e0b;
    border-radius: var(--sb-radius);
}

.trash-banner>i {
    margin-top: 2px;
    color: #d97706;
}

.trash-zone .sb-card {
    border-color: #fde68a;
    border-top: 3px solid #f59e0b;
    background-image: repeating-linear-gradient(135deg, transparent 0 14px, rgba(245, 158, 11, .035) 14px 28px);
}

.trash-zone .ct-filters {
    background: #fffbeb;
    border-bottom-color: #fde68a;
}

.trash-zone .sb-table th {
    background: #fffbeb;
    border-bottom-color: #fde68a;
    color: #92400e;
}

.trash-zone .sb-table td {
    border-color: #fef3c7;
}

/* Linhas desbotadas: não parecem contactos/campanhas "vivos" */
.trash-zone #trBody tr td:not(:first-child) {
    opacity: .72;
}

.trash-zone #trBody tr:hover td {
    background: #fffbeb;
    opacity: 1;
}

.trash-zone #trBody .sb-contact strong {
    font-weight: 600;
    text-decoration: line-through;
    text-decoration-color: rgba(180, 83, 9, .45);
}

.trash-zone .tpl-seg button.is-active {
    background: #92400e;
    border-color: #92400e;
}

.trash-zone .ct-bulk {
    background: #fef3c7;
    border-bottom-color: #fde68a;
}

.trash-zone .sb-table tr.is-selected td {
    background: #fef3c7;
}

.trash-zone .ct-check {
    accent-color: #b45309;
}

.trash-zone .sb-pager {
    border-top-color: #fde68a;
}

/* A barra lateral também destaca a Lixeira */
.sb-rail__item[title="Lixeira"] {
    color: #b45309;
}

.sb-rail__item[title="Lixeira"]:hover {
    background: #fffbeb;
    color: #92400e;
}

.sb-rail__item[title="Lixeira"].active {
    background: #fef3c7;
    color: #92400e;
}

.sb-rail__item[title="Lixeira"].active i {
    color: #d97706;
}