/* =========================================================
   SOCPLACE — MARKETPLACE
   FICHEIRO: assets/css/socplace.css

   Estilo global:
   - Layout administrativo
   - Cabeçalho
   - Menu lateral
   - Dashboard
   - Formulários
   - Tabelas
   - Alertas
   - Contadores de mensagens
   - Suporte flutuante
   - Telemóveis e tablets
========================================================= */

/* =========================================================
   1. VARIÁVEIS
========================================================= */

:root {
    --sp-primary: #174ea6;
    --sp-primary-dark: #103a7c;
    --sp-primary-deep: #0b2d61;
    --sp-primary-light: #eaf1fb;

    --sp-background: #edf1f6;
    --sp-surface: #ffffff;
    --sp-surface-soft: #f8fafc;

    --sp-text: #182230;
    --sp-muted: #667085;

    --sp-border: #d6dde7;
    --sp-border-strong: #bbc5d2;

    --sp-success: #157347;
    --sp-success-bg: #e9f7ef;

    --sp-danger: #b42318;
    --sp-danger-bg: #fff1f0;

    --sp-warning: #9a6700;
    --sp-warning-bg: #fff8db;

    --sp-info: #175cd3;
    --sp-info-bg: #eff6ff;

    --sp-sidebar-width: 270px;
    --sp-topbar-height: 68px;

    --sp-radius-large: 14px;
    --sp-radius-medium: 9px;
    --sp-radius-small: 6px;

    --sp-shadow:
        0 10px 28px
        rgba(16, 24, 40, 0.08);
}

/* =========================================================
   2. REINICIALIZAÇÃO
========================================================= */

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: var(--sp-background);
    -webkit-text-size-adjust: 100%;
}

body {
    min-width: 320px;
    min-height: 100vh;
    margin: 0;
    color: var(--sp-text);
    background: var(--sp-background);
    font-family:
        Arial,
        Helvetica,
        sans-serif;
    font-size: 14px;
    line-height: 1.5;
}

body.sidebar-open {
    overflow: hidden;
}

a {
    color: inherit;
}

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

button,
a {
    touch-action: manipulation;
}

img {
    max-width: 100%;
}

/* =========================================================
   3. LAYOUT PRINCIPAL
========================================================= */

.sp-app {
    min-height: 100vh;
}

.sp-main-wrapper {
    min-height: 100vh;
    margin-left: var(--sp-sidebar-width);
    padding-top: var(--sp-topbar-height);
    transition: margin-left 0.2s ease;
}

.sp-content {
    width: 100%;
    max-width: 1600px;
    margin: 0 auto;
    padding: 24px;
}

/* =========================================================
   4. CABEÇALHO SUPERIOR
========================================================= */

.sp-topbar {
    position: fixed;
    z-index: 1000;
    top: 0;
    right: 0;
    left: var(--sp-sidebar-width);
    height: var(--sp-topbar-height);
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    background: var(--sp-surface);
    border-bottom: 1px solid var(--sp-border);
    transition: left 0.2s ease;
}

.sp-topbar-left {
    min-width: 0;
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    gap: 14px;
}

.sp-mobile-menu-button {
    width: 42px;
    height: 42px;
    padding: 0;
    display: none;
    align-items: center;
    justify-content: center;
    color: var(--sp-text);
    background: var(--sp-surface-soft);
    border: 1px solid var(--sp-border);
    border-radius: 8px;
    cursor: pointer;
}

.sp-mobile-menu-button span,
.sp-mobile-menu-button span::before,
.sp-mobile-menu-button span::after {
    width: 20px;
    height: 2px;
    display: block;
    background: currentColor;
    border-radius: 4px;
}

.sp-mobile-menu-button span {
    position: relative;
}

.sp-mobile-menu-button span::before,
.sp-mobile-menu-button span::after {
    position: absolute;
    left: 0;
    content: "";
}

.sp-mobile-menu-button span::before {
    top: -6px;
}

.sp-mobile-menu-button span::after {
    top: 6px;
}

.sp-page-heading {
    min-width: 0;
}

.sp-page-title {
    margin: 0;
    overflow: hidden;
    color: var(--sp-text);
    font-size: 20px;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sp-page-subtitle {
    margin: 2px 0 0;
    overflow: hidden;
    color: var(--sp-muted);
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sp-topbar-actions {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 10px;
}

.sp-icon-button {
    position: relative;
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--sp-text);
    background: var(--sp-surface-soft);
    border: 1px solid var(--sp-border);
    border-radius: 50%;
    text-decoration: none;
    transition:
        background-color 0.15s ease,
        border-color 0.15s ease,
        color 0.15s ease;
}

.sp-icon-button:hover {
    color: var(--sp-primary);
    background: var(--sp-primary-light);
    border-color: #b8ccef;
}

.sp-icon-button:focus-visible {
    outline: 3px solid rgba(23, 78, 166, 0.22);
    outline-offset: 2px;
}

.sp-notification-count {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    background: var(--sp-danger);
    border: 2px solid #ffffff;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 800;
    line-height: 1;
}

/* =========================================================
   5. MENU DO UTILIZADOR
========================================================= */

.sp-user-menu {
    position: relative;
}

.sp-user-menu summary {
    min-height: 46px;
    padding: 4px 9px 4px 5px;
    display: flex;
    align-items: center;
    gap: 9px;
    background: var(--sp-surface);
    border: 1px solid var(--sp-border);
    border-radius: 999px;
    cursor: pointer;
    list-style: none;
    user-select: none;
}

.sp-user-menu summary::-webkit-details-marker {
    display: none;
}

.sp-user-menu summary::marker {
    content: "";
}

.sp-user-menu summary:focus-visible {
    outline: 3px solid rgba(23, 78, 166, 0.22);
    outline-offset: 2px;
}

.sp-user-avatar {
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    color: #ffffff;
    background:
        linear-gradient(
            135deg,
            var(--sp-primary),
            var(--sp-primary-dark)
        );
    border-radius: 50%;
    font-size: 14px;
    font-weight: 800;
}

.sp-user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.sp-user-summary-text {
    min-width: 0;
    max-width: 155px;
}

.sp-user-name {
    display: block;
    overflow: hidden;
    color: var(--sp-text);
    font-size: 12px;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sp-user-role {
    display: block;
    overflow: hidden;
    color: var(--sp-muted);
    font-size: 10px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sp-user-menu-arrow {
    color: var(--sp-muted);
    font-size: 10px;
}

.sp-user-dropdown {
    position: absolute;
    z-index: 1200;
    top: calc(100% + 10px);
    right: 0;
    width: 240px;
    overflow: hidden;
    background: var(--sp-surface);
    border: 1px solid var(--sp-border);
    border-radius: 10px;
    box-shadow: var(--sp-shadow);
}

.sp-user-menu:not([open])
.sp-user-dropdown {
    display: none;
}

.sp-user-dropdown-header {
    padding: 15px;
    background: var(--sp-surface-soft);
    border-bottom: 1px solid var(--sp-border);
}

.sp-user-dropdown-name {
    margin: 0;
    color: var(--sp-text);
    font-size: 13px;
    font-weight: 700;
}

.sp-user-dropdown-email {
    margin: 3px 0 0;
    overflow-wrap: anywhere;
    color: var(--sp-muted);
    font-size: 11px;
}

.sp-user-dropdown-links {
    padding: 7px;
}

.sp-user-dropdown-link {
    min-height: 42px;
    padding: 9px 10px;
    display: flex;
    align-items: center;
    gap: 9px;
    color: var(--sp-text);
    border-radius: 7px;
    text-decoration: none;
}

.sp-user-dropdown-link:hover {
    background: var(--sp-primary-light);
}

.sp-user-dropdown-link.danger {
    color: var(--sp-danger);
}

/* =========================================================
   6. MENU LATERAL
========================================================= */

.sp-sidebar {
    position: fixed;
    z-index: 1100;
    top: 0;
    bottom: 0;
    left: 0;
    width: var(--sp-sidebar-width);
    display: flex;
    flex-direction: column;
    color: #ffffff;
    background:
        linear-gradient(
            180deg,
            var(--sp-primary-deep),
            #0c346e
        );
    transition: transform 0.22s ease;
}

.sp-sidebar-brand {
    height: var(--sp-topbar-height);
    padding: 0 20px;
    display: flex;
    align-items: center;
    gap: 11px;
    color: #ffffff;
    border-bottom:
        1px solid
        rgba(255, 255, 255, 0.12);
    text-decoration: none;
}

.sp-sidebar-brand-symbol {
    width: 39px;
    height: 39px;
    flex: 0 0 39px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--sp-primary-deep);
    background: #ffffff;
    border-radius: 10px;
    font-size: 20px;
    font-weight: 900;
}

.sp-sidebar-brand-name {
    min-width: 0;
    overflow: hidden;
    font-size: 22px;
    font-weight: 900;
    letter-spacing: 0.6px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sp-sidebar-body {
    flex: 1;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 16px 12px 24px;
    scrollbar-width: thin;
    scrollbar-color:
        rgba(255, 255, 255, 0.28)
        transparent;
}

.sp-sidebar-body::-webkit-scrollbar {
    width: 7px;
}

.sp-sidebar-body::-webkit-scrollbar-track {
    background: transparent;
}

.sp-sidebar-body::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.25);
    border-radius: 999px;
}

.sp-menu-section {
    margin-bottom: 20px;
}

.sp-menu-title {
    margin: 0 10px 8px;
    color: rgba(255, 255, 255, 0.55);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 1.2px;
    text-transform: uppercase;
}

.sp-menu {
    margin: 0;
    padding: 0;
    display: grid;
    gap: 4px;
    list-style: none;
}

.sp-menu-link {
    position: relative;
    min-height: 45px;
    padding: 10px 12px;
    display: flex;
    align-items: center;
    gap: 11px;
    color: rgba(255, 255, 255, 0.84);
    border-radius: 8px;
    text-decoration: none;
    transition:
        color 0.15s ease,
        background 0.15s ease;
}

.sp-menu-link:hover,
.sp-menu-link.active {
    color: #ffffff;
    background:
        rgba(255, 255, 255, 0.13);
}

.sp-menu-link.active {
    box-shadow:
        inset 3px 0 0
        #ffffff;
}

.sp-menu-link:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.8);
    outline-offset: 2px;
}

.sp-menu-icon {
    width: 24px;
    flex: 0 0 24px;
    text-align: center;
    font-size: 16px;
}

.sp-menu-text {
    min-width: 0;
    flex: 1 1 auto;
    overflow: hidden;
    font-size: 13px;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ---------------------------------------------------------
   CONTADOR DO MENU
--------------------------------------------------------- */

.sp-menu-count {
    min-width: 22px;
    height: 22px;
    flex: 0 0 auto;
    padding: 0 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    background: var(--sp-danger);
    border: 1px solid rgba(255, 255, 255, 0.28);
    border-radius: 999px;
    font-size: 10px;
    font-weight: 900;
    line-height: 1;
}

.sp-menu-link.active
.sp-menu-count {
    color: var(--sp-primary-deep);
    background: #ffffff;
    border-color: #ffffff;
}

.sp-sidebar-footer {
    padding: 14px 18px;
    color: rgba(255, 255, 255, 0.55);
    border-top:
        1px solid
        rgba(255, 255, 255, 0.12);
    font-size: 10px;
    line-height: 1.5;
}

.sp-sidebar-overlay {
    position: fixed;
    z-index: 1050;
    inset: 0;
    display: none;
    background: rgba(15, 23, 42, 0.54);
    backdrop-filter: blur(2px);
}

/* =========================================================
   7. CABEÇALHO DE CONTEÚDO
========================================================= */

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

.sp-content-title {
    margin: 0;
    color: var(--sp-text);
    font-size: 25px;
    line-height: 1.25;
}

.sp-content-description {
    max-width: 750px;
    margin: 7px 0 0;
    color: var(--sp-muted);
    font-size: 13px;
    line-height: 1.6;
}

.sp-content-actions {
    flex: 0 0 auto;
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
}

/* =========================================================
   8. BOTÕES
========================================================= */

.sp-button {
    min-height: 42px;
    padding: 9px 15px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1px solid transparent;
    border-radius: 7px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
}

.sp-button-primary {
    color: #ffffff;
    background: var(--sp-primary);
}

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

.sp-button-secondary {
    color: var(--sp-text);
    background: var(--sp-surface);
    border-color: var(--sp-border);
}

.sp-button-secondary:hover {
    background: var(--sp-surface-soft);
}

.sp-button-danger {
    color: #ffffff;
    background: var(--sp-danger);
}

/* =========================================================
   9. ALERTAS
========================================================= */

.sp-alerts {
    margin-bottom: 20px;
    display: grid;
    gap: 10px;
}

.sp-alert {
    padding: 13px 15px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    border: 1px solid transparent;
    border-radius: 9px;
    font-size: 13px;
    line-height: 1.55;
}

.sp-alert-icon {
    width: 22px;
    height: 22px;
    flex: 0 0 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    border-radius: 50%;
    font-size: 11px;
    font-weight: 800;
}

.sp-alert-success {
    color: var(--sp-success);
    background: var(--sp-success-bg);
    border-color: #afdcc0;
}

.sp-alert-success .sp-alert-icon {
    background: var(--sp-success);
}

.sp-alert-error {
    color: var(--sp-danger);
    background: var(--sp-danger-bg);
    border-color: #f0b4ae;
}

.sp-alert-error .sp-alert-icon {
    background: var(--sp-danger);
}

.sp-alert-warning {
    color: var(--sp-warning);
    background: var(--sp-warning-bg);
    border-color: #ecd57d;
}

.sp-alert-warning .sp-alert-icon {
    background: var(--sp-warning);
}

.sp-alert-info {
    color: var(--sp-info);
    background: var(--sp-info-bg);
    border-color: #b2ccff;
}

.sp-alert-info .sp-alert-icon {
    background: var(--sp-info);
}

/* =========================================================
   10. GRELHA DE INDICADORES
========================================================= */

.sp-kpi-grid {
    margin-bottom: 22px;
    display: grid;
    grid-template-columns:
        repeat(4, minmax(0, 1fr));
    gap: 16px;
}

.sp-kpi-card {
    min-width: 0;
    padding: 18px;
    background: var(--sp-surface);
    border: 1px solid var(--sp-border);
    border-radius: var(--sp-radius-large);
    box-shadow:
        0 5px 18px
        rgba(16, 24, 40, 0.045);
}

.sp-kpi-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.sp-kpi-label {
    margin: 0;
    color: var(--sp-muted);
    font-size: 12px;
    font-weight: 700;
}

.sp-kpi-value {
    margin: 7px 0 0;
    color: var(--sp-text);
    font-size: 28px;
    font-weight: 800;
    line-height: 1.15;
}

.sp-kpi-icon {
    width: 43px;
    height: 43px;
    flex: 0 0 43px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--sp-primary);
    background: var(--sp-primary-light);
    border-radius: 11px;
    font-size: 19px;
}

.sp-kpi-footer {
    margin-top: 13px;
    color: var(--sp-muted);
    font-size: 11px;
}

/* =========================================================
   11. PAINÉIS
========================================================= */

.sp-grid-two {
    margin-bottom: 22px;
    display: grid;
    grid-template-columns:
        minmax(0, 1.2fr)
        minmax(320px, 0.8fr);
    gap: 18px;
}

.sp-panel {
    min-width: 0;
    background: var(--sp-surface);
    border: 1px solid var(--sp-border);
    border-radius: var(--sp-radius-large);
    box-shadow:
        0 5px 18px
        rgba(16, 24, 40, 0.045);
}

.sp-panel-header {
    min-height: 61px;
    padding: 15px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    border-bottom: 1px solid var(--sp-border);
}

.sp-panel-title {
    margin: 0;
    color: var(--sp-text);
    font-size: 15px;
}

.sp-panel-subtitle {
    margin: 3px 0 0;
    color: var(--sp-muted);
    font-size: 11px;
}

.sp-panel-body {
    padding: 18px;
}

/* =========================================================
   12. GRÁFICO SIMPLES
========================================================= */

.sp-bar-chart {
    min-height: 260px;
    display: flex;
    align-items: flex-end;
    gap: 10px;
}

.sp-bar-item {
    min-width: 0;
    height: 230px;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    text-align: center;
}

.sp-bar-value {
    margin-bottom: 6px;
    color: var(--sp-text);
    font-size: 11px;
    font-weight: 700;
}

.sp-bar-track {
    height: 180px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    background:
        linear-gradient(
            to top,
            transparent,
            rgba(23, 78, 166, 0.025)
        );
    border-bottom: 1px solid var(--sp-border);
    border-radius: 6px 6px 0 0;
}

.sp-bar-fill {
    width: min(70%, 38px);
    min-height: 5px;
    background:
        linear-gradient(
            180deg,
            #4383d5,
            var(--sp-primary)
        );
    border-radius: 6px 6px 0 0;
}

.sp-bar-label {
    margin-top: 8px;
    color: var(--sp-muted);
    font-size: 10px;
}

/* =========================================================
   13. LISTA DE RESUMO
========================================================= */

.sp-summary-list {
    margin: 0;
    padding: 0;
    display: grid;
    list-style: none;
}

.sp-summary-item {
    min-height: 58px;
    padding: 11px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 13px;
    border-bottom: 1px solid var(--sp-border);
}

.sp-summary-item:last-child {
    border-bottom: 0;
}

.sp-summary-info {
    min-width: 0;
}

.sp-summary-label {
    margin: 0;
    color: var(--sp-text);
    font-size: 12px;
    font-weight: 700;
}

.sp-summary-description {
    margin: 3px 0 0;
    color: var(--sp-muted);
    font-size: 10px;
}

.sp-summary-value {
    flex: 0 0 auto;
    color: var(--sp-primary);
    font-size: 17px;
    font-weight: 800;
}

/* =========================================================
   14. TABELAS
========================================================= */

.sp-table-responsive {
    width: 100%;
    overflow-x: auto;
    border-radius: 8px;
    -webkit-overflow-scrolling: touch;
}

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

.sp-table th,
.sp-table td {
    padding: 12px 13px;
    vertical-align: middle;
    border-bottom: 1px solid var(--sp-border);
    text-align: left;
}

.sp-table th {
    color: var(--sp-muted);
    background: var(--sp-surface-soft);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.4px;
    text-transform: uppercase;
}

.sp-table td {
    color: var(--sp-text);
    font-size: 12px;
}

.sp-table tbody tr:hover {
    background: #fbfcfe;
}

.sp-table tbody tr:last-child td {
    border-bottom: 0;
}

/* =========================================================
   15. BADGES
========================================================= */

.sp-badge {
    min-height: 24px;
    padding: 4px 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    white-space: nowrap;
}

.sp-badge-success {
    color: var(--sp-success);
    background: var(--sp-success-bg);
}

.sp-badge-danger {
    color: var(--sp-danger);
    background: var(--sp-danger-bg);
}

.sp-badge-warning {
    color: var(--sp-warning);
    background: var(--sp-warning-bg);
}

.sp-badge-info {
    color: var(--sp-info);
    background: var(--sp-info-bg);
}

.sp-badge-neutral {
    color: #475467;
    background: #eef1f5;
}

/* =========================================================
   16. ESTADO VAZIO
========================================================= */

.sp-empty-state {
    padding: 38px 20px;
    color: var(--sp-muted);
    text-align: center;
}

.sp-empty-icon {
    margin-bottom: 9px;
    font-size: 30px;
}

.sp-empty-title {
    margin: 0;
    color: var(--sp-text);
    font-size: 14px;
}

.sp-empty-text {
    max-width: 480px;
    margin: 6px auto 0;
    font-size: 11px;
    line-height: 1.6;
}

/* =========================================================
   17. RODAPÉ
========================================================= */

.sp-footer {
    margin-top: 28px;
    padding: 18px 0 4px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    color: var(--sp-muted);
    border-top: 1px solid var(--sp-border);
    font-size: 10px;
}

/* =========================================================
   18. SUPORTE FLUTUANTE PERMANENTE
========================================================= */

.sp-support-float {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 9000;
}

/* ---------------------------------------------------------
   BOTÃO PRINCIPAL
--------------------------------------------------------- */

.sp-support-float > summary {
    position: relative;
    min-width: 132px;
    min-height: 52px;
    padding: 11px 17px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    color: #ffffff;
    background:
        linear-gradient(
            135deg,
            var(--sp-primary),
            var(--sp-primary-dark)
        );
    border: 1px solid rgba(255, 255, 255, 0.24);
    border-radius: 999px;
    box-shadow:
        0 12px 32px
        rgba(16, 45, 83, 0.30);
    cursor: pointer;
    font-weight: 900;
    list-style: none;
    user-select: none;
    transition:
        background-color 0.2s ease,
        transform 0.2s ease,
        box-shadow 0.2s ease;
}

.sp-support-float > summary::-webkit-details-marker {
    display: none;
}

.sp-support-float > summary::marker {
    content: "";
}

.sp-support-float > summary:hover {
    transform: translateY(-1px);
    box-shadow:
        0 15px 38px
        rgba(16, 45, 83, 0.36);
}

.sp-support-float[open] > summary {
    background:
        linear-gradient(
            135deg,
            var(--sp-primary-dark),
            var(--sp-primary-deep)
        );
}

.sp-support-float > summary:focus-visible {
    outline: 3px solid rgba(23, 78, 166, 0.30);
    outline-offset: 3px;
}

.sp-support-float-icon {
    width: 29px;
    height: 29px;
    flex: 0 0 29px;
    display: inline-grid;
    place-items: center;
    color: #ffffff;
    background: rgba(255, 255, 255, 0.14);
    border-radius: 50%;
    font-size: 17px;
}

.sp-support-float-label {
    font-size: 13px;
}

/* ---------------------------------------------------------
   CONTADOR FLUTUANTE
--------------------------------------------------------- */

.sp-support-float-count {
    position: absolute;
    top: -6px;
    right: -4px;
    min-width: 24px;
    height: 24px;
    padding: 0 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    background: var(--sp-danger);
    border: 2px solid #ffffff;
    border-radius: 999px;
    font-size: 9px;
    font-weight: 900;
    line-height: 1;
}

/* ---------------------------------------------------------
   PAINEL DO SUPORTE
--------------------------------------------------------- */

.sp-support-float-panel {
    position: absolute;
    right: 0;
    bottom: calc(100% + 12px);
    width: min(355px, calc(100vw - 30px));
    overflow: hidden;
    color: var(--sp-text);
    background: var(--sp-surface);
    border: 1px solid var(--sp-border);
    border-radius: 15px;
    box-shadow:
        0 22px 60px
        rgba(14, 34, 55, 0.25);
}

.sp-support-float:not([open])
.sp-support-float-panel {
    display: none;
}

/* ---------------------------------------------------------
   CABEÇALHO DO PAINEL
--------------------------------------------------------- */

.sp-support-float-header {
    padding: 17px;
    display: flex;
    align-items: center;
    gap: 12px;
    color: #ffffff;
    background:
        linear-gradient(
            135deg,
            var(--sp-primary-deep),
            var(--sp-primary)
        );
}

.sp-support-float-avatar {
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    display: grid;
    place-items: center;
    color: #ffffff;
    background: rgba(255, 255, 255, 0.13);
    border: 2px solid rgba(255, 255, 255, 0.45);
    border-radius: 50%;
    font-size: 18px;
    font-weight: 900;
}

.sp-support-float-header div {
    min-width: 0;
}

.sp-support-float-header strong {
    display: block;
    margin-bottom: 4px;
    overflow: hidden;
    color: #ffffff;
    font-size: 14px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sp-support-float-header div > span {
    display: block;
    color: rgba(255, 255, 255, 0.82);
    font-size: 11px;
    line-height: 1.4;
}

/* ---------------------------------------------------------
   AVISO DO PAINEL
--------------------------------------------------------- */

.sp-support-float-alert {
    margin: 14px 14px 0;
    padding: 10px 11px;
    color: #73530d;
    background: #fff6df;
    border-left: 4px solid #c68a18;
    border-radius: 7px;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.5;
}

/* ---------------------------------------------------------
   AÇÕES DO PAINEL
--------------------------------------------------------- */

.sp-support-float-actions {
    padding: 14px;
    display: grid;
    gap: 8px;
}

.sp-support-float-primary,
.sp-support-float-secondary {
    min-height: 41px;
    padding: 9px 13px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 900;
    text-align: center;
    text-decoration: none;
    transition:
        background-color 0.2s ease,
        border-color 0.2s ease,
        color 0.2s ease;
}

.sp-support-float-primary {
    color: #ffffff;
    background: var(--sp-primary);
    border: 1px solid var(--sp-primary);
}

.sp-support-float-primary:hover {
    color: #ffffff;
    background: var(--sp-primary-dark);
    border-color: var(--sp-primary-dark);
}

.sp-support-float-secondary {
    color: var(--sp-text);
    background: var(--sp-surface);
    border: 1px solid var(--sp-border);
}

.sp-support-float-secondary:hover {
    color: var(--sp-primary-dark);
    background: var(--sp-primary-light);
    border-color: #b8ccef;
}

.sp-support-float-primary:focus-visible,
.sp-support-float-secondary:focus-visible {
    outline: 3px solid rgba(23, 78, 166, 0.25);
    outline-offset: 2px;
}

/* ---------------------------------------------------------
   NOTA INFERIOR
--------------------------------------------------------- */

.sp-support-float-note {
    margin: 0;
    padding: 0 14px 14px;
    color: var(--sp-muted);
    font-size: 10px;
    line-height: 1.5;
    text-align: center;
}

/* =========================================================
   19. TABLETS
========================================================= */

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

    .sp-grid-two {
        grid-template-columns: 1fr;
    }
}

/* =========================================================
   20. TELEMÓVEIS E TABLETS PEQUENOS
========================================================= */

@media (max-width: 850px) {
    .sp-sidebar {
        transform: translateX(-100%);
        box-shadow:
            18px 0 45px
            rgba(15, 23, 42, 0.25);
    }

    body.sidebar-open .sp-sidebar {
        transform: translateX(0);
    }

    body.sidebar-open .sp-sidebar-overlay {
        display: block;
    }

    .sp-main-wrapper {
        margin-left: 0;
    }

    .sp-topbar {
        left: 0;
        padding-right:
            max(14px, env(safe-area-inset-right));
        padding-left:
            max(14px, env(safe-area-inset-left));
    }

    .sp-mobile-menu-button {
        display: inline-flex;
        flex: 0 0 42px;
    }

    .sp-content {
        padding: 19px 15px;
    }
}

/* =========================================================
   21. TELEMÓVEIS
========================================================= */

@media (max-width: 600px) {
    body {
        font-size: 14px;
    }

    input,
    select,
    textarea {
        font-size: 16px;
    }

    .sp-topbar {
        height: 64px;
        gap: 7px;
    }

    .sp-main-wrapper {
        padding-top: 64px;
    }

    .sp-topbar-left {
        gap: 8px;
    }

    .sp-topbar-actions {
        gap: 6px;
    }

    .sp-mobile-menu-button {
        width: 40px;
        height: 40px;
        flex-basis: 40px;
    }

    .sp-icon-button {
        width: 38px;
        height: 38px;
        flex-basis: 38px;
    }

    .sp-notification-count {
        top: -5px;
        right: -5px;
        min-width: 19px;
        height: 19px;
        font-size: 9px;
    }

    .sp-page-heading {
        min-width: 0;
    }

    .sp-page-title {
        font-size: 16px;
    }

    .sp-page-subtitle {
        display: none;
    }

    .sp-user-summary-text,
    .sp-user-menu-arrow {
        display: none;
    }

    .sp-user-menu summary {
        width: 40px;
        height: 40px;
        min-height: 40px;
        padding: 2px;
        justify-content: center;
    }

    .sp-user-avatar {
        width: 34px;
        height: 34px;
        flex-basis: 34px;
    }

    .sp-user-dropdown {
        position: fixed;
        top: 62px;
        right: 12px;
        left: 12px;
        width: auto;
    }

    .sp-content {
        padding:
            17px
            max(11px, env(safe-area-inset-right))
            20px
            max(11px, env(safe-area-inset-left));
    }

    .sp-content-header {
        margin-bottom: 17px;
        display: block;
    }

    .sp-content-title {
        font-size: 21px;
    }

    .sp-content-description {
        margin-top: 5px;
        font-size: 12px;
    }

    .sp-content-actions {
        margin-top: 13px;
    }

    .sp-content-actions .sp-button {
        width: 100%;
    }

    .sp-kpi-grid {
        grid-template-columns: 1fr;
        gap: 11px;
    }

    .sp-kpi-card {
        padding: 16px;
    }

    .sp-kpi-value {
        font-size: 25px;
    }

    .sp-panel-header {
        padding: 13px 14px;
    }

    .sp-panel-body {
        padding: 14px;
    }

    .sp-bar-chart {
        gap: 5px;
    }

    .sp-bar-label {
        font-size: 9px;
    }

    .sp-footer {
        display: block;
        text-align: center;
    }

    .sp-footer span {
        display: block;
        margin-top: 4px;
    }

    /* -----------------------------------------------------
       SUPORTE FLUTUANTE NO TELEMÓVEL
    ----------------------------------------------------- */

    .sp-support-float {
        right: 14px;
        bottom: 14px;
    }

    .sp-support-float > summary {
        width: 52px;
        height: 52px;
        min-width: 52px;
        min-height: 52px;
        padding: 0;
    }

    .sp-support-float-label {
        display: none;
    }

    .sp-support-float-panel {
        position: fixed;
        right: 12px;
        bottom: 78px;
        left: 12px;
        width: auto;
        max-height: calc(100vh - 100px);
        overflow-y: auto;
    }
}

/* =========================================================
   22. ECRÃS MUITO PEQUENOS
========================================================= */

@media (max-width: 370px) {
    .sp-topbar {
        padding-right: 7px;
        padding-left: 7px;
    }

    .sp-topbar-left {
        gap: 6px;
    }

    .sp-topbar-actions {
        gap: 4px;
    }

    .sp-page-heading {
        max-width: 105px;
    }

    .sp-page-title {
        font-size: 14px;
    }

    .sp-mobile-menu-button {
        width: 38px;
        height: 38px;
        flex-basis: 38px;
    }

    .sp-icon-button {
        width: 36px;
        height: 36px;
        flex-basis: 36px;
    }

    .sp-user-menu summary {
        width: 38px;
        height: 38px;
        min-height: 38px;
    }

    .sp-user-avatar {
        width: 32px;
        height: 32px;
        flex-basis: 32px;
    }

    .sp-content {
        padding-right: 8px;
        padding-left: 8px;
    }

    .sp-support-float {
        right: 10px;
        bottom: 10px;
    }

    .sp-support-float-panel {
        right: 8px;
        bottom: 72px;
        left: 8px;
    }
}

/* =========================================================
   23. ACESSIBILIDADE
========================================================= */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}