/* =========================================================
   Serveasy Prospect Desk v0.5.7
   Premium Product Polish
   Camada transversal e organizada de acabamento visual.
   Não altera lógica funcional nem a paleta Serveasy.
   ========================================================= */

:root {
    --sidebar-width: 264px;
    --surface-page: #f4f7fb;
    --surface-subtle: #f8fafc;
    --surface-blue: #f3faff;
    --line-soft: rgba(216, 225, 236, .82);
    --line-blue: rgba(49, 139, 54, .18);
    --shadow-card: 0 10px 28px rgba(15, 23, 42, .055);
    --shadow-card-hover: 0 16px 38px rgba(15, 23, 42, .08);
    --shadow-floating: 0 18px 48px rgba(15, 23, 42, .12);
    --radius-panel: 20px;
    --radius-control: 12px;
}

html {
    background: var(--surface-page);
}

body.app-page {
    background:
        radial-gradient(circle at 92% 2%, rgba(49, 139, 54, .055), transparent 25%),
        linear-gradient(180deg, #f7f9fc 0, var(--surface-page) 320px);
}

body.menu-open {
    overflow: hidden;
}

::selection {
    background: rgba(49, 139, 54, .2);
    color: var(--ink);
}

/* ---------------------------------------------------------
   Shell e navegação lateral
   --------------------------------------------------------- */

.sidebar {
    width: var(--sidebar-width);
    padding: 18px 16px 16px;
    overflow-y: auto;
    overflow-x: hidden;
    background:
        linear-gradient(180deg, rgba(255,255,255,.98), rgba(248,251,254,.98)),
        #fff;
    border-right: 1px solid rgba(216, 225, 236, .9);
    box-shadow: 10px 0 34px rgba(15, 23, 42, .035);
}

.sidebar::before {
    content: '';
    position: absolute;
    inset: 0 0 auto;
    height: 3px;
    background: linear-gradient(90deg, var(--serveasy-blue), #6EAF63 64%, transparent);
}

.sidebar-brand {
    margin: 2px 2px 20px;
}

.brand-link {
    gap: 11px;
    min-height: 62px;
    padding: 8px;
    border: 1px solid transparent;
    border-radius: 17px;
    transition: background .18s ease, border-color .18s ease, box-shadow .18s ease;
}

.brand-link:hover {
    border-color: var(--line-soft);
    background: rgba(255,255,255,.88);
    box-shadow: 0 9px 24px rgba(15, 23, 42, .05);
}

.brand-logo-wrap {
    display: grid;
    width: 46px;
    height: 46px;
    flex: 0 0 46px;
    place-items: center;
    border: 1px solid rgba(216, 225, 236, .9);
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 8px 20px rgba(15, 23, 42, .07);
}

.brand-logo {
    width: 38px;
    height: 38px;
    padding: 2px;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

.brand-copy,
.brand-copy strong,
.brand-copy small {
    display: block;
    min-width: 0;
}

.brand-copy strong {
    color: var(--ink);
    font-size: 16px;
    font-weight: 850;
    letter-spacing: -.035em;
    white-space: nowrap;
}

.brand-copy small {
    margin-top: 3px;
    color: var(--muted);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .045em;
    text-transform: uppercase;
}

.sidebar-nav {
    display: grid;
    gap: 18px;
}

.nav-group {
    display: grid;
    gap: 6px;
}

.nav-group-label {
    padding: 0 12px;
    color: #94a0b2;
    font-size: 9px;
    font-weight: 850;
    letter-spacing: .11em;
    text-transform: uppercase;
}

.nav-group-items {
    display: grid;
    gap: 4px;
}

.nav-item {
    position: relative;
    min-height: 43px;
    gap: 10px;
    padding: 8px 10px;
    overflow: hidden;
    border: 1px solid transparent;
    border-radius: 12px;
    color: #526176;
    font-size: 13px;
    font-weight: 720;
    transition: color .16s ease, background .16s ease, border-color .16s ease, transform .16s ease;
}

.nav-item::before {
    content: '';
    position: absolute;
    inset: 9px auto 9px 0;
    width: 3px;
    border-radius: 0 6px 6px 0;
    background: transparent;
}

.nav-item:hover {
    color: var(--serveasy-blue-dark);
    background: rgba(49, 139, 54, .055);
    transform: translateX(1px);
}

.nav-item.is-active {
    border-color: rgba(49, 139, 54, .14);
    background: linear-gradient(100deg, rgba(49, 139, 54, .13), rgba(49, 139, 54, .045));
    color: var(--serveasy-blue-dark);
    box-shadow: 0 7px 18px rgba(49, 139, 54, .08);
}

.nav-item.is-active::before {
    background: var(--serveasy-blue);
}

.nav-icon {
    width: 28px;
    height: 28px;
    flex: 0 0 28px;
    border: 1px solid rgba(15, 23, 42, .045);
    border-radius: 9px;
    background: rgba(15, 23, 42, .035);
}

.nav-icon svg,
.logout-icon svg,
.menu-toggle svg,
.topbar-primary-action svg {
    width: 17px;
    height: 17px;
    fill: currentColor;
}

.nav-item.is-active .nav-icon {
    border-color: rgba(49, 139, 54, .16);
    background: #fff;
    box-shadow: 0 5px 12px rgba(49, 139, 54, .1);
}

.nav-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-footer {
    gap: 10px;
    padding-top: 18px;
}

.user-mini {
    position: relative;
    gap: 10px;
    padding: 10px;
    border-radius: 15px;
    box-shadow: 0 8px 22px rgba(15, 23, 42, .055);
    transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}

.user-mini:hover {
    border-color: rgba(49, 139, 54, .22);
    box-shadow: 0 12px 28px rgba(15, 23, 42, .075);
    transform: translateY(-1px);
}

.user-avatar {
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
    border-radius: 11px;
    box-shadow: 0 7px 16px rgba(49, 139, 54, .2);
}

.user-copy {
    min-width: 0;
    flex: 1;
}

.user-copy strong,
.user-copy small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-copy strong {
    color: var(--ink);
    font-size: 12px;
}

.user-copy small {
    margin-top: 2px;
    color: var(--muted);
    font-size: 10px;
}

.user-chevron {
    color: #9aa6b7;
    font-size: 20px;
    line-height: 1;
}

.sidebar-bottom-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 0 4px;
}

.version-pill {
    display: inline-flex;
    align-items: center;
    min-height: 25px;
    padding: 0 8px;
    border: 1px solid var(--line-soft);
    border-radius: 999px;
    background: rgba(255,255,255,.78);
    color: #8894a6;
    font-size: 9px;
    font-weight: 800;
}

.logout-button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 31px;
    padding: 0 9px;
    border-radius: 9px;
    color: #a51d3b;
    font-size: 11px;
    font-weight: 800;
    transition: background .16s ease, color .16s ease;
}

.logout-button:hover {
    background: rgba(190, 24, 93, .07);
    color: #8f1233;
}

.logout-icon {
    display: grid;
    place-items: center;
}

.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 45;
    border: 0;
    background: rgba(15, 23, 42, .42);
    backdrop-filter: blur(3px);
}

/* ---------------------------------------------------------
   Área principal e cabeçalho de página
   --------------------------------------------------------- */

.main-content {
    min-height: 100vh;
    padding: 22px 26px 30px;
}

.topbar {
    min-height: 72px;
    margin-bottom: 18px;
}

.topbar-copy {
    min-width: 0;
    flex: 1;
}

.topbar-kicker {
    display: block;
    margin-bottom: 4px;
    color: var(--serveasy-blue-dark);
    font-size: 9px;
    font-weight: 850;
    letter-spacing: .1em;
    text-transform: uppercase;
}

.topbar h1 {
    font-size: clamp(27px, 2.4vw, 34px);
    letter-spacing: -.05em;
}

.topbar p {
    max-width: 760px;
    margin-top: 6px;
    color: #66758a;
    font-size: 13px;
    line-height: 1.45;
}

.topbar-actions {
    flex: 0 0 auto;
}

.menu-toggle {
    width: 42px;
    height: 42px;
    border: 1px solid var(--line-soft);
    color: #415167;
}

.topbar-primary-action svg {
    flex: 0 0 17px;
}

/* ---------------------------------------------------------
   Sistema visual global: painéis, botões e formulários
   --------------------------------------------------------- */

.panel {
    border-color: var(--line-soft);
    border-radius: var(--radius-panel);
    box-shadow: var(--shadow-card);
}

.panel-header {
    margin-bottom: 16px;
}

.panel-header h2,
.hero-panel h2 {
    color: var(--ink);
    font-size: 20px;
    letter-spacing: -.035em;
}

.panel-header p,
.hero-panel p {
    margin-top: 5px;
    color: #6a778b;
    font-size: 13px;
    line-height: 1.5;
}

.btn {
    min-height: 40px;
    padding: 0 14px;
    border-radius: 11px;
    font-size: 13px;
    font-weight: 780;
    transition: transform .16s ease, box-shadow .16s ease, background .16s ease, border-color .16s ease;
}

.btn-primary {
    background: linear-gradient(135deg, #318B36, #4F9F4B);
    box-shadow: 0 9px 20px rgba(49, 139, 54, .2);
}

.btn-primary:hover {
    box-shadow: 0 12px 25px rgba(49, 139, 54, .26);
}

.btn-secondary {
    border-color: var(--line-soft);
    background: rgba(255,255,255,.92);
    color: #425168;
    box-shadow: 0 5px 13px rgba(15, 23, 42, .035);
}

.btn-secondary:hover {
    border-color: rgba(49, 139, 54, .22);
    color: var(--serveasy-blue-dark);
    box-shadow: 0 8px 18px rgba(15, 23, 42, .06);
}

.field {
    gap: 6px;
}

.field span {
    color: #28364b;
    font-size: 12px;
    font-weight: 760;
}

.field input,
.field select,
.field textarea,
.account-form .field input {
    min-height: 42px;
    padding: 10px 12px;
    border-color: #dce4ee;
    border-radius: var(--radius-control);
    color: #18243a;
    font-size: 13px;
    box-shadow: inset 0 1px 1px rgba(15, 23, 42, .018);
}

.field textarea {
    min-height: 108px;
}

.field input:hover,
.field select:hover,
.field textarea:hover {
    border-color: #cbd6e4;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
    border-color: rgba(49, 139, 54, .62);
    box-shadow: 0 0 0 3px rgba(49, 139, 54, .1);
}

.filter-panel {
    padding: 17px;
    border-radius: 18px;
    background: rgba(255,255,255,.94);
}

.filter-actions {
    align-items: center;
}

.filter-check {
    min-height: 40px;
    font-size: 12px;
}

input[type='checkbox'] {
    accent-color: var(--serveasy-blue);
}

.alert {
    border-radius: 13px;
    box-shadow: 0 8px 20px rgba(15, 23, 42, .035);
}

.empty-state {
    padding: 38px 22px;
    border-color: #cfdae8;
    border-radius: 18px;
    background:
        radial-gradient(circle at 50% 0, rgba(49, 139, 54, .065), transparent 36%),
        linear-gradient(180deg, #fff, #fafcff);
}

.empty-icon {
    border: 1px solid rgba(49, 139, 54, .14);
    box-shadow: 0 8px 20px rgba(49, 139, 54, .08);
}

.empty-state h3 {
    font-size: 18px;
}

.empty-state p {
    font-size: 13px;
}

/* ---------------------------------------------------------
   Métricas e dashboard
   --------------------------------------------------------- */

.metrics-grid {
    gap: 12px;
    margin-bottom: 18px;
}

.metric-card {
    min-width: 0;
    padding: 17px 18px;
    border-color: var(--line-soft);
    border-radius: 17px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, .045);
    transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}

.metric-card:hover {
    border-color: rgba(49, 139, 54, .17);
    box-shadow: var(--shadow-card-hover);
    transform: translateY(-2px);
}

.metric-card::after {
    width: 78px;
    height: 78px;
    right: -28px;
    top: -29px;
}

.metric-card span {
    color: #5f6e83;
    font-size: 11px;
    letter-spacing: .02em;
    text-transform: uppercase;
}

.metric-card strong {
    margin: 8px 0 4px;
    font-size: 29px;
}

.metric-card small {
    font-size: 10px;
}

.dashboard-crm-grid {
    gap: 16px;
}

.action-row {
    min-height: 57px;
    padding: 10px 8px;
    border-radius: 11px;
    transition: background .16s ease, transform .16s ease;
}

.action-row:hover {
    background: #f7fbfe;
    transform: translateX(2px);
}

.action-row strong {
    color: #1a263a;
    font-size: 13px;
}

.action-row span,
.action-row small {
    font-size: 11px;
}

.dashboard-shortcuts a {
    position: relative;
    padding: 11px 34px 11px 12px;
    border-radius: 11px;
    font-size: 12px;
    transition: border-color .16s ease, background .16s ease, transform .16s ease;
}

.dashboard-shortcuts a::after {
    content: '›';
    position: absolute;
    right: 13px;
    top: 50%;
    color: #9aa8b9;
    font-size: 19px;
    transform: translateY(-52%);
}

.dashboard-shortcuts a:hover {
    background: var(--surface-blue);
    transform: translateX(2px);
}

.prospect-row {
    border-radius: 14px;
    box-shadow: none;
}

/* ---------------------------------------------------------
   Tabelas e grelhas operacionais
   --------------------------------------------------------- */

.prospects-table-wrap,
.spreadsheet-wrap {
    border-color: var(--line-soft);
    border-radius: 15px;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.8);
}

.premium-table th,
.premium-table td {
    border-bottom-color: #e8edf3;
}

.premium-table th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #f6f9fc;
    color: #5c6a7f;
    font-size: 10px;
    letter-spacing: .055em;
}

.premium-table tbody tr {
    transition: background .14s ease;
}

.premium-table tbody tr:hover td {
    background: #f8fbfe;
}

.table-title strong {
    font-size: 13px;
}

.table-title span,
.premium-table td > small {
    font-size: 10px;
}

.table-action-btn,
.icon-btn {
    min-height: 31px;
    border: 1px solid rgba(216, 225, 236, .9);
    border-radius: 9px;
    background: #fff;
    color: #4b5b70;
    box-shadow: 0 4px 10px rgba(15, 23, 42, .035);
}

.table-action-open {
    border-color: rgba(49, 139, 54, .18);
    background: rgba(49, 139, 54, .075);
    color: var(--serveasy-blue-dark);
}

.table-action-btn:hover,
.icon-btn:hover {
    border-color: rgba(49, 139, 54, .25);
    background: #f1faff;
    box-shadow: 0 7px 15px rgba(15, 23, 42, .055);
}

.crm-contact-table th,
.crm-contact-table td {
    padding-top: 10px !important;
    padding-bottom: 10px !important;
}

.crm-contact-table .table-title strong {
    font-size: 12px;
}

.crm-contact-table .table-title span,
.crm-contact-table td > small {
    font-size: 10px;
}

.crm-contact-table .badge {
    min-height: 26px;
    border-radius: 9px;
}

.pagination a {
    border-color: var(--line-soft);
    box-shadow: 0 3px 8px rgba(15, 23, 42, .025);
}

/* ---------------------------------------------------------
   Newsletter tipo planilha
   --------------------------------------------------------- */

.compact-metrics {
    max-width: none;
}

.sheet-toolbar {
    padding: 11px 12px;
    border-color: var(--line-soft);
    border-radius: 14px 14px 0 0;
    background: linear-gradient(180deg, #fafcff, #f4f7fb);
}

.sheet-toolbar-actions select {
    height: 38px;
    border-color: #d7e0eb;
    border-radius: 10px;
    font-size: 11px;
}

.spreadsheet-wrap {
    border-radius: 0 0 14px 14px;
}

.spreadsheet-table th {
    padding: 10px;
    background: #eef3f8;
    color: #56657b;
}

.spreadsheet-table td {
    padding: 9px 10px;
    border-color: #e7ecf2;
}

.spreadsheet-table tbody tr:nth-child(even) td {
    background: #fcfdff;
}

.spreadsheet-table tbody tr:hover td {
    background: #f2f9fe;
}

/* ---------------------------------------------------------
   Formulários de contacto
   --------------------------------------------------------- */

.form-layout {
    gap: 16px;
}

.form-section {
    padding: 18px;
    border-color: var(--line-soft);
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 6px 20px rgba(15, 23, 42, .028);
}

.form-section-head {
    margin-bottom: 17px;
    padding-bottom: 14px;
    border-bottom: 1px solid #edf1f6;
    align-items: center;
}

/* Cabeçalhos do formulário: neutraliza o .section-kicker genérico do CRM. */
.form-section .section-kicker {
    width: 34px;
    height: 34px;
    min-width: 34px;
    min-height: 34px;
    flex: 0 0 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    border: 1px solid rgba(49, 139, 54, .14);
    border-radius: 11px;
    background: rgba(49, 139, 54, .06);
    color: var(--serveasy-blue-dark);
    font-size: 11px;
    font-weight: 850;
    line-height: 1;
    letter-spacing: 0;
    text-transform: none;
    vertical-align: middle;
}

.form-section-head > div {
    min-width: 0;
}

.form-section .form-section-icon svg {
    width: 17px;
    height: 17px;
    display: block;
    margin: 0;
    flex: 0 0 auto;
}

.form-section-head h2,
.side-note-panel h2 {
    font-size: 18px;
}

.form-section-head p {
    font-size: 12px;
}

.form-grid {
    gap: 12px;
}

.evaluation-long-field {
    margin-top: 16px;
}

.notes-field {
    margin-top: 18px;
}

.closure-card {
    margin-top: 22px;
    margin-bottom: 17px;
    padding: 15px;
    border-radius: 15px;
}

.closure-reason-field {
    margin-top: 0;
}

.side-note-panel {
    position: sticky;
    top: 18px;
    border-radius: 18px;
}

.mini-checklist span,
.data-stack span {
    border-radius: 11px;
    background: #fbfdff;
}

.sticky-actions {
    bottom: 14px;
    border-radius: 15px;
    background: rgba(248, 250, 252, .9);
    box-shadow: 0 13px 32px rgba(15, 23, 42, .1);
}

/* ---------------------------------------------------------
   Conta, definições e páginas técnicas
   --------------------------------------------------------- */

.account-grid {
    gap: 16px;
}

.account-panel {
    position: relative;
    overflow: hidden;
    padding: 21px;
}

.account-panel::before {
    content: '';
    position: absolute;
    width: 112px;
    height: 112px;
    right: -52px;
    top: -58px;
    border-radius: 50%;
    background: rgba(49, 139, 54, .065);
}

.account-form {
    gap: 12px;
}

.account-form-actions {
    padding-top: 6px;
}

.data-stack {
    gap: 9px;
}

.data-stack span {
    min-height: 56px;
    padding: 11px 12px;
    border: 1px solid var(--line-soft);
}

.rule-card {
    border-radius: 14px;
}

.settings-page .content-grid,
.exports-page .content-grid,
.archive-page .content-grid {
    gap: 16px;
}

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

.settings-card {
    position: relative;
    min-width: 0;
    padding: 18px;
    overflow: hidden;
    border: 1px solid var(--line-soft);
    border-radius: 17px;
    background: #fff;
    box-shadow: var(--shadow-card);
}

.settings-card::after {
    content: '';
    position: absolute;
    width: 76px;
    height: 76px;
    right: -30px;
    top: -34px;
    border-radius: 50%;
    background: rgba(49, 139, 54, .07);
}

.settings-card-label {
    display: block;
    color: var(--serveasy-blue-dark);
    font-size: 9px;
    font-weight: 850;
    letter-spacing: .09em;
    text-transform: uppercase;
}

.settings-card strong {
    display: block;
    margin-top: 7px;
    color: var(--ink);
    font-size: 18px;
    letter-spacing: -.025em;
}

.settings-card p {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.5;
}

.settings-main-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(320px, .85fr);
    gap: 16px;
}

.settings-rule-list {
    display: grid;
    gap: 10px;
}

.settings-rule {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr);
    gap: 11px;
    padding: 13px;
    border: 1px solid var(--line-soft);
    border-radius: 13px;
    background: #fbfdff;
}

.settings-rule-icon {
    display: grid;
    width: 34px;
    height: 34px;
    place-items: center;
    border-radius: 10px;
    background: rgba(49, 139, 54, .09);
    color: var(--serveasy-blue-dark);
    font-size: 15px;
    font-weight: 850;
}

.settings-rule strong,
.settings-rule p {
    display: block;
}

.settings-rule strong {
    color: var(--ink);
    font-size: 13px;
}

.settings-rule p {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.5;
}

.settings-diagnostic-card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 100%;
    background:
        radial-gradient(circle at top right, rgba(49, 139, 54, .11), transparent 32%),
        #fff;
}

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

.export-summary-card {
    padding: 15px 16px;
    border: 1px solid var(--line-soft);
    border-radius: 15px;
    background: #fff;
    box-shadow: 0 7px 20px rgba(15, 23, 42, .04);
}

.export-summary-card span,
.export-summary-card strong,
.export-summary-card small {
    display: block;
}

.export-summary-card span {
    color: var(--muted);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .055em;
    text-transform: uppercase;
}

.export-summary-card strong {
    margin-top: 7px;
    color: var(--ink);
    font-size: 23px;
}

.export-summary-card small {
    margin-top: 3px;
    color: #718095;
    font-size: 10px;
}

.diagnostic-hero {
    min-height: 220px;
    border-color: rgba(49, 139, 54, .14);
    background:
        radial-gradient(circle at 90% 0, rgba(49, 139, 54, .14), transparent 30%),
        #fff;
}

.diagnostic-table-wrap {
    border-radius: 15px;
}

/* ---------------------------------------------------------
   Ficha premium: integração com o sistema global
   --------------------------------------------------------- */

.record-hero,
.record-data-panel,
.record-context-panel,
.record-flow-panel {
    border-color: var(--line-soft);
    box-shadow: var(--shadow-card);
}

.record-toolbar {
    margin-bottom: 12px;
}

.record-breadcrumb {
    border-color: var(--line-soft);
    box-shadow: 0 5px 14px rgba(15, 23, 42, .035);
}

.record-status-tile,
.record-context-list > div {
    border-color: var(--line-soft);
}

.record-data-row {
    border-bottom-color: #edf1f5;
}

.record-flow-panel {
    border-radius: 18px;
}

.premium-flow-composer {
    border-radius: 14px;
}

/* ---------------------------------------------------------
   Responsivo
   --------------------------------------------------------- */

@media (max-width: 1180px) {
    .settings-overview,
    .export-summary-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

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

@media (max-width: 820px) {
    .sidebar {
        width: min(286px, 86vw);
        padding-top: 16px;
    }

    .sidebar-backdrop {
        display: block;
        visibility: hidden;
        opacity: 0;
        pointer-events: none;
        transition: opacity .2s ease, visibility .2s ease;
    }

    body.menu-open .sidebar-backdrop {
        visibility: visible;
        opacity: 1;
        pointer-events: auto;
    }

    .main-content {
        width: 100%;
        flex-basis: 100%;
        padding: 17px;
    }

    .topbar {
        min-height: 64px;
        align-items: flex-start;
    }

    .topbar-kicker {
        margin-top: 2px;
    }

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

    .topbar p {
        font-size: 12px;
    }

    .settings-overview,
    .export-summary-grid,
    .account-grid {
        grid-template-columns: 1fr;
    }

    .sheet-toolbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .sheet-toolbar-actions {
        width: 100%;
    }

    .sheet-toolbar-actions select,
    .sheet-toolbar-actions .btn {
        flex: 1 1 150px;
    }
}

@media (max-width: 560px) {
    .main-content {
        padding: 14px;
    }

    .panel,
    .account-panel {
        padding: 16px;
        border-radius: 17px;
    }

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

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

    .form-section {
        padding: 15px;
    }

    .form-actions {
        width: 100%;
    }

    .form-actions .btn {
        flex: 1;
    }
}

/* Conta: identificação e segurança */
.account-overview {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 16px;
    padding: 17px 19px;
    background:
        radial-gradient(circle at 92% 0, rgba(49, 139, 54, .1), transparent 28%),
        #fff;
}

.account-overview-avatar {
    display: grid;
    width: 48px;
    height: 48px;
    flex: 0 0 48px;
    place-items: center;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--serveasy-blue), #4F9F4B);
    color: #fff;
    box-shadow: 0 10px 22px rgba(49, 139, 54, .2);
    font-size: 17px;
    font-weight: 850;
}

.account-overview-copy {
    min-width: 0;
    flex: 1;
}

.account-overview-copy .section-kicker {
    color: var(--serveasy-blue-dark);
}

.account-overview-copy h2 {
    margin: 3px 0 0;
    color: var(--ink);
    font-size: 19px;
    letter-spacing: -.035em;
}

.account-overview-copy p {
    margin: 4px 0 0;
    overflow: hidden;
    color: var(--muted);
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.account-security-badge {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 0 10px;
    border: 1px solid rgba(22, 163, 74, .15);
    border-radius: 999px;
    background: rgba(22, 163, 74, .07);
    color: #17743a;
    font-size: 10px;
    font-weight: 800;
    white-space: nowrap;
}

@media (max-width: 560px) {
    .account-overview {
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .account-security-badge {
        margin-left: 62px;
    }
}

/* =========================================================
   Serveasy Prospect Desk v0.5.7
   Sidebar com estado único · Perfil com fotografia premium
   ========================================================= */

/* O destaque pertence exclusivamente ao módulo activo. */
.nav-item:not(.is-active) {
    box-shadow: none;
}

/* Perfil compacto da sidebar */
.user-mini {
    gap: 11px;
    min-height: 64px;
    padding: 9px 10px;
    border: 1px solid rgba(216, 225, 236, .9);
    border-radius: 16px;
    background: linear-gradient(145deg, #fff, #f8fbfe);
    box-shadow: 0 7px 20px rgba(15, 23, 42, .045);
}

.user-mini:hover {
    border-color: rgba(49, 139, 54, .22);
    background: #fff;
    box-shadow: 0 11px 26px rgba(15, 23, 42, .07);
    transform: translateY(-1px);
}

.user-avatar {
    position: relative;
    display: grid;
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    place-items: center;
    overflow: visible;
    border: 2px solid #fff;
    border-radius: 50%;
    background: linear-gradient(145deg, var(--serveasy-blue), #4F9F4B);
    color: #fff;
    box-shadow: 0 7px 18px rgba(49, 139, 54, .18), 0 0 0 1px rgba(49, 139, 54, .12);
    font-size: 14px;
    font-weight: 850;
}

.user-avatar.has-photo {
    background: #e8f0f6;
}

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

.user-avatar > span {
    margin: 0;
    color: inherit;
    font-size: inherit;
    line-height: 1;
}

.user-presence {
    position: absolute;
    right: -1px;
    bottom: 0;
    width: 10px;
    height: 10px;
    border: 2px solid #fff;
    border-radius: 50%;
    background: #22c55e;
    box-shadow: 0 2px 6px rgba(34, 197, 94, .28);
}

.user-copy strong {
    font-size: 12px;
    font-weight: 800;
}

.user-copy small {
    font-size: 10px;
    font-weight: 600;
}

.user-profile-action {
    display: grid;
    width: 28px;
    height: 28px;
    flex: 0 0 28px;
    place-items: center;
    margin: 0;
    border-radius: 9px;
    background: rgba(49, 139, 54, .065);
    color: var(--serveasy-blue-dark);
    transition: background .16s ease, transform .16s ease;
}

.user-profile-action svg {
    width: 15px;
    height: 15px;
    fill: currentColor;
}

.user-mini:hover .user-profile-action {
    background: rgba(49, 139, 54, .13);
    transform: translate(1px, -1px);
}

/* Cabeçalho de perfil da Conta */
.account-profile-hero {
    position: relative;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 18px;
    min-height: 132px;
    margin-bottom: 16px;
    padding: 21px 23px;
    overflow: hidden;
    border-color: rgba(49, 139, 54, .12);
    background:
        radial-gradient(circle at 96% -12%, rgba(49, 139, 54, .13), transparent 32%),
        linear-gradient(135deg, #fff 0%, #fbfdff 64%, #F5FAF6 100%);
    transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}

.account-profile-hero::after {
    content: '';
    position: absolute;
    right: 32%;
    bottom: -72px;
    width: 180px;
    height: 180px;
    border: 1px solid rgba(49, 139, 54, .07);
    border-radius: 50%;
    pointer-events: none;
}

.account-profile-hero.is-dragging {
    border-color: rgba(49, 139, 54, .48);
    box-shadow: 0 0 0 4px rgba(49, 139, 54, .09), var(--shadow-card-hover);
    transform: translateY(-1px);
}

.account-photo-area {
    display: grid;
    justify-items: center;
    gap: 7px;
    position: relative;
    z-index: 1;
}

.account-photo-button {
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    cursor: pointer;
}

.account-photo-frame {
    position: relative;
    display: grid;
    width: 82px;
    height: 82px;
    place-items: center;
    overflow: hidden;
    border: 4px solid #fff;
    border-radius: 50%;
    background: linear-gradient(145deg, var(--serveasy-blue), #4F9F4B);
    color: #fff;
    box-shadow: 0 14px 32px rgba(49, 139, 54, .2), 0 0 0 1px rgba(49, 139, 54, .12);
}

.account-photo-frame img {
    width: 100%;
    height: 100%;
    border-radius: inherit;
    object-fit: cover;
}

.account-photo-initial {
    font-size: 26px;
    font-weight: 850;
    letter-spacing: -.04em;
}

.account-photo-overlay {
    position: absolute;
    inset: auto 0 0;
    display: grid;
    height: 32px;
    place-items: center;
    background: linear-gradient(180deg, transparent, rgba(4, 36, 58, .74));
    opacity: 0;
    transform: translateY(5px);
    transition: opacity .17s ease, transform .17s ease;
}

.account-photo-overlay svg {
    width: 17px;
    height: 17px;
    fill: #fff;
}

.account-photo-button:hover .account-photo-overlay,
.account-photo-button:focus-visible .account-photo-overlay {
    opacity: 1;
    transform: translateY(0);
}

.account-photo-help {
    color: #8090a5;
    font-size: 9px;
    font-weight: 650;
    white-space: nowrap;
}

.account-profile-copy {
    position: relative;
    z-index: 1;
    min-width: 0;
}

.account-profile-copy h2 {
    margin: 4px 0 0;
    color: var(--ink);
    font-size: 22px;
    font-weight: 850;
    letter-spacing: -.045em;
}

.account-profile-copy > p {
    margin: 5px 0 0;
    overflow: hidden;
    color: var(--muted);
    font-size: 13px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.account-profile-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px 14px;
    margin-top: 12px;
    color: #66758a;
    font-size: 10.5px;
    font-weight: 650;
}

.account-profile-meta span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.account-profile-meta i {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #22c55e;
    box-shadow: 0 0 0 3px rgba(34, 197, 94, .1);
}

.account-profile-actions {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 8px;
}

.account-photo-action {
    gap: 8px;
}

.account-photo-action svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

.account-photo-remove {
    color: #9f2741;
}

.account-photo-remove[data-confirming="true"] {
    border-color: rgba(190, 24, 93, .22);
    background: rgba(190, 24, 93, .07);
    color: #9f1239;
}

.account-photo-remove.is-hidden {
    display: none;
}

.account-avatar-feedback {
    position: absolute;
    right: 23px;
    bottom: 11px;
    min-height: 16px;
    color: var(--muted);
    font-size: 10px;
    font-weight: 650;
}

.account-avatar-feedback:empty {
    display: none;
}

.account-avatar-feedback.is-success {
    color: #15803d;
}

.account-avatar-feedback.is-error {
    color: #b4233d;
}

/* Editor moderno de fotografia */
body.avatar-editor-open {
    overflow: hidden;
}

.avatar-editor-modal[hidden] {
    display: none !important;
}

.avatar-editor-modal {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: grid;
    place-items: center;
    padding: 22px;
}

.avatar-editor-backdrop {
    position: absolute;
    inset: 0;
    border: 0;
    background: rgba(11, 24, 43, .62);
    backdrop-filter: blur(7px);
}

.avatar-editor-dialog {
    position: relative;
    width: min(590px, 100%);
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, .5);
    border-radius: 24px;
    background: #fff;
    box-shadow: 0 28px 90px rgba(3, 14, 30, .3);
    animation: avatar-dialog-in .2s ease-out both;
}

@keyframes avatar-dialog-in {
    from { opacity: 0; transform: translateY(9px) scale(.985); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.avatar-editor-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    padding: 20px 22px 17px;
    border-bottom: 1px solid var(--line-soft);
}

.avatar-editor-header h2 {
    margin: 4px 0 0;
    color: var(--ink);
    font-size: 19px;
    letter-spacing: -.035em;
}

.avatar-editor-header p {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 11.5px;
}

.avatar-editor-close {
    display: grid;
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    place-items: center;
    border: 1px solid var(--line-soft);
    border-radius: 11px;
    background: #f8fafc;
    color: #6f7d90;
    cursor: pointer;
    transition: background .15s ease, color .15s ease, transform .15s ease;
}

.avatar-editor-close:hover {
    background: #eef4f8;
    color: var(--ink);
    transform: rotate(3deg);
}

.avatar-editor-close svg {
    width: 17px;
    height: 17px;
    fill: currentColor;
}

.avatar-editor-body {
    display: grid;
    justify-items: center;
    gap: 18px;
    padding: 21px 22px 18px;
    background: linear-gradient(180deg, #f8fbfd, #fff);
}

.avatar-crop-shell {
    position: relative;
    width: min(360px, 78vw);
    aspect-ratio: 1;
    overflow: hidden;
    border-radius: 50%;
    background: #e9f0f5;
    box-shadow: 0 16px 40px rgba(15, 23, 42, .16), 0 0 0 8px #fff, 0 0 0 9px rgba(49, 139, 54, .13);
    cursor: grab;
    touch-action: none;
}

.avatar-crop-shell.is-dragging {
    cursor: grabbing;
}

.avatar-crop-shell canvas {
    display: block;
    width: 100%;
    height: 100%;
}

.avatar-crop-guide {
    position: absolute;
    inset: 0;
    border: 1px solid rgba(255,255,255,.78);
    border-radius: 50%;
    box-shadow: inset 0 0 0 1px rgba(15, 23, 42, .11);
    pointer-events: none;
}

.avatar-drag-hint {
    position: absolute;
    left: 50%;
    bottom: 18px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 29px;
    padding: 0 10px;
    border: 1px solid rgba(255,255,255,.32);
    border-radius: 999px;
    background: rgba(8, 30, 48, .62);
    color: #fff;
    font-size: 9.5px;
    font-weight: 720;
    white-space: nowrap;
    transform: translateX(-50%);
    pointer-events: none;
    backdrop-filter: blur(5px);
}

.avatar-drag-hint svg {
    width: 13px;
    height: 13px;
    fill: currentColor;
}

.avatar-editor-controls {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 16px;
    width: min(430px, 100%);
}

.avatar-editor-controls label {
    display: grid;
    flex: 1;
    gap: 7px;
    color: var(--ink);
    font-size: 11px;
    font-weight: 760;
}

.avatar-editor-controls input[type="range"] {
    width: 100%;
    accent-color: var(--serveasy-blue);
    cursor: pointer;
}

.avatar-editor-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 9px;
    padding: 15px 22px 18px;
    border-top: 1px solid var(--line-soft);
    background: #fff;
}

.avatar-editor-actions .is-loading {
    opacity: .72;
    cursor: wait;
}

@media (max-width: 760px) {
    .account-profile-hero {
        grid-template-columns: auto minmax(0, 1fr);
        padding: 18px;
    }

    .account-profile-actions {
        grid-column: 1 / -1;
        justify-content: flex-start;
        padding-left: 98px;
    }

    .account-avatar-feedback {
        position: static;
        grid-column: 1 / -1;
    }
}

@media (max-width: 520px) {
    .account-profile-hero {
        grid-template-columns: 1fr;
        justify-items: center;
        text-align: center;
    }

    .account-profile-copy > p {
        white-space: normal;
    }

    .account-profile-meta,
    .account-profile-actions {
        justify-content: center;
        padding-left: 0;
    }

    .account-profile-actions {
        flex-wrap: wrap;
    }

    .avatar-editor-modal {
        padding: 10px;
    }

    .avatar-editor-dialog {
        border-radius: 20px;
    }

    .avatar-editor-header,
    .avatar-editor-body,
    .avatar-editor-actions {
        padding-left: 16px;
        padding-right: 16px;
    }

    .avatar-editor-controls {
        align-items: stretch;
        flex-direction: column;
    }

    .avatar-editor-controls .btn {
        width: 100%;
    }
}

/* =========================================================
   Serveasy Prospect Desk v0.6.0
   Ativos, Convertidos e Arquivados
   ========================================================= */

.prospect-group-tabs {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 16px;
    padding: 5px;
    border: 1px solid var(--line-soft, var(--line));
    border-radius: 16px;
    background: rgba(255,255,255,.82);
    box-shadow: 0 8px 22px rgba(15,23,42,.045);
}

.prospect-group-tab {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    min-height: 38px;
    padding: 0 13px;
    border-radius: 12px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 720;
    transition: background .16s ease, color .16s ease, box-shadow .16s ease;
}

.prospect-group-tab strong {
    display: grid;
    min-width: 23px;
    height: 23px;
    place-items: center;
    padding: 0 6px;
    border-radius: 999px;
    background: #edf3f7;
    color: #526174;
    font-size: 11px;
}

.prospect-group-tab:hover {
    color: var(--ink);
    background: #f3f8fb;
}

.prospect-group-tab.is-active {
    color: var(--serveasy-blue-dark);
    background: linear-gradient(135deg, rgba(49,139,54,.13), rgba(49,139,54,.06));
    box-shadow: inset 0 0 0 1px rgba(49,139,54,.16);
}

.prospect-group-tab.is-active strong {
    color: #fff;
    background: var(--serveasy-blue);
}

.filter-context {
    color: var(--muted);
    font-size: 12px;
}

.btn-convert,
.btn-convert-soft {
    border: 1px solid rgba(22,163,74,.2);
}

.btn-convert {
    color: #fff;
    background: linear-gradient(135deg, #159447, #0f7e3b);
    box-shadow: 0 10px 22px rgba(22,163,74,.16);
}

.btn-convert:hover {
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 13px 26px rgba(22,163,74,.22);
}

.btn-convert-soft {
    color: #0d7c39;
    background: rgba(22,163,74,.08);
}

.btn-danger-soft {
    color: #b42318;
    border: 1px solid rgba(220,38,38,.18);
    background: rgba(220,38,38,.07);
}

.btn-danger-soft:hover {
    background: rgba(220,38,38,.12);
}

body.modal-open {
    overflow: hidden;
}

.app-modal {
    position: fixed;
    z-index: 1300;
    inset: 0;
    display: grid;
    visibility: hidden;
    place-items: center;
    padding: 22px;
    opacity: 0;
    transition: opacity .18s ease, visibility .18s ease;
}

.app-modal.is-open {
    visibility: visible;
    opacity: 1;
}

.app-modal-backdrop {
    position: absolute;
    inset: 0;
    border: 0;
    background: rgba(9,21,38,.58);
    backdrop-filter: blur(7px);
}

.app-modal-dialog {
    position: relative;
    width: min(680px, 100%);
    overflow: hidden;
    border: 1px solid rgba(255,255,255,.65);
    border-radius: 24px;
    background: #fff;
    box-shadow: 0 28px 90px rgba(3,14,30,.3);
    transform: translateY(8px) scale(.985);
    transition: transform .18s ease;
}

.app-modal.is-open .app-modal-dialog {
    transform: translateY(0) scale(1);
}

.app-modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    padding: 20px 22px 17px;
    border-bottom: 1px solid var(--line-soft, var(--line));
}

.app-modal-header h2 {
    margin: 4px 0 0;
    font-size: 21px;
    letter-spacing: -.035em;
}

.app-modal-header p {
    margin: 5px 0 0;
    color: var(--muted);
    font-size: 13px;
}

.app-modal-close {
    display: grid;
    width: 35px;
    height: 35px;
    flex: 0 0 35px;
    place-items: center;
    border: 1px solid var(--line-soft, var(--line));
    border-radius: 11px;
    background: #f7fafc;
    color: #64748b;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
}

.app-modal-body {
    padding: 20px 22px;
    background: linear-gradient(180deg, #f9fbfd, #fff);
}

.conversion-modal-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 15px;
}

.app-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 9px;
    padding: 15px 22px 18px;
    border-top: 1px solid var(--line-soft, var(--line));
}

.record-panel-link {
    color: var(--serveasy-blue-dark);
    font-size: 12px;
    font-weight: 750;
}

.record-conversion-panel {
    border-color: rgba(22,163,74,.18);
    background: linear-gradient(180deg, rgba(240,253,244,.8), #fff 42%);
}

.record-conversion-summary {
    display: grid;
    grid-template-columns: repeat(2, minmax(0,1fr));
    gap: 10px;
}

.record-conversion-summary > div {
    display: grid;
    gap: 4px;
    padding: 12px 13px;
    border: 1px solid rgba(22,163,74,.12);
    border-radius: 13px;
    background: rgba(255,255,255,.78);
}

.record-conversion-summary span {
    color: var(--muted);
    font-size: 11px;
    font-weight: 730;
}

.record-conversion-summary strong,
.record-conversion-summary p {
    margin: 0;
    color: var(--ink);
    font-size: 13px;
    line-height: 1.5;
}

.record-conversion-summary p small {
    display: block;
    margin-top: 4px;
    color: var(--muted);
    font-size: 11px;
}

.record-conversion-wide {
    grid-column: 1 / -1;
}

.converted-flow-notice {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 16px;
    padding: 14px 16px;
    border: 1px solid rgba(22,163,74,.18);
    border-radius: 14px;
    background: rgba(240,253,244,.78);
}

.converted-flow-notice strong {
    color: #0f7a38;
    font-size: 13px;
}

.converted-flow-notice span {
    color: var(--muted);
    font-size: 12px;
}

.converted-filters {
    display: grid;
    grid-template-columns: 1.05fr .8fr .8fr 1fr 1fr 1fr 1.25fr auto;
    align-items: end;
    gap: 12px;
}

.converted-filter-actions {
    display: flex;
    gap: 8px;
}

.converted-table {
    width: 100%;
    table-layout: fixed;
}

.converted-table .c-name { width: 10%; }
.converted-table .c-company { width: 10%; }
.converted-table .c-sector { width: 7%; }
.converted-table .c-date { width: 8%; }
.converted-table .c-origin { width: 8%; }
.converted-table .c-reason { width: 16%; }
.converted-table .c-owner { width: 8%; }
.converted-table .c-next { width: 13%; }
.converted-table .c-crm { width: 7%; }
.converted-table .c-lead { width: 5%; }
.converted-table .c-actions { width: 8%; }

.converted-table th,
.converted-table td {
    overflow-wrap: anywhere;
    vertical-align: top;
}

.converted-table td {
    font-size: 12px;
    line-height: 1.42;
}

.converted-table td small {
    display: block;
    margin-top: 3px;
    color: var(--muted);
    font-size: 10.5px;
}

.converted-long-text {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 4;
}

.converted-actions {
    display: grid;
    gap: 5px;
}

.converted-actions a {
    display: inline-flex;
    min-height: 29px;
    align-items: center;
    justify-content: center;
    padding: 0 7px;
    border: 1px solid var(--line-soft, var(--line));
    border-radius: 9px;
    background: #fff;
    color: #42536a;
    font-size: 10.5px;
    font-weight: 720;
}

.converted-actions a:hover {
    color: var(--serveasy-blue-dark);
    border-color: rgba(49,139,54,.24);
    background: rgba(49,139,54,.055);
}

.conversion-edit-layout {
    grid-template-columns: minmax(0, 1.6fr) minmax(300px, .72fr);
}

.conversion-edit-form {
    display: grid;
    gap: 17px;
}

.conversion-meta-card h2 {
    margin-top: 0;
}

.conversion-revert-box {
    margin-top: 20px;
    padding-top: 18px;
    border-top: 1px solid var(--line-soft, var(--line));
}

.conversion-revert-box h3 {
    margin: 5px 0 7px;
    font-size: 16px;
}

.conversion-revert-box p {
    margin: 0 0 13px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.55;
}

.conversion-revert-box form {
    display: grid;
    gap: 10px;
}

.conversion-form-note {
    display: grid;
    gap: 4px;
    margin-top: 18px;
    padding: 14px 16px;
    border: 1px solid rgba(22,163,74,.17);
    border-radius: 14px;
    background: rgba(240,253,244,.72);
}

.conversion-form-note strong {
    color: #0f7a38;
    font-size: 13px;
}

.conversion-form-note span {
    color: var(--muted);
    font-size: 12px;
}

.dashboard-summary-metrics {
    grid-template-columns: repeat(4, minmax(0,1fr));
}

.metric-muted {
    --metric-accent: #64748b;
}

@media (max-width: 1500px) {
    .converted-filters {
        grid-template-columns: repeat(4, minmax(0,1fr));
    }

    .converted-filter-actions {
        grid-column: span 1;
    }

    .converted-table td,
    .converted-table th {
        padding-left: 8px;
        padding-right: 8px;
    }
}

@media (max-width: 1050px) {
    .prospect-group-tabs {
        display: flex;
        width: 100%;
    }

    .prospect-group-tab {
        flex: 1;
        justify-content: center;
    }

    .converted-filters,
    .conversion-modal-form {
        grid-template-columns: repeat(2, minmax(0,1fr));
    }

    .conversion-edit-layout {
        grid-template-columns: 1fr;
    }

    .converted-table-wrap {
        overflow-x: auto;
    }

    .converted-table {
        min-width: 1320px;
    }
}

@media (max-width: 640px) {
    .prospect-group-tabs {
        align-items: stretch;
        flex-direction: column;
    }

    .prospect-group-tab {
        justify-content: space-between;
    }

    .converted-filters,
    .conversion-modal-form,
    .record-conversion-summary {
        grid-template-columns: 1fr;
    }

    .record-conversion-wide {
        grid-column: auto;
    }

    .converted-flow-notice {
        align-items: flex-start;
        flex-direction: column;
    }

    .app-modal {
        padding: 10px;
    }

    .app-modal-dialog {
        max-height: calc(100vh - 20px);
        overflow-y: auto;
        border-radius: 19px;
    }
}
.converted-actions a.is-danger {
    color: #b42318;
    border-color: rgba(220,38,38,.14);
    background: rgba(220,38,38,.035);
}

/* =========================================================
   Serveasy Prospect Desk v0.6.1
   Sidebar configurável · tabelas compactas · hierarquia cromática
   ========================================================= */

:root {
    --ink: #17243d;
    --ink-soft: #34445d;
    --heading-ink: #102a4c;
    --name-blue: #155A26;
    --name-blue-hover: #155A26;
}

body.app-page {
    color: var(--ink-soft);
}

body.app-page h1,
body.app-page h2,
body.app-page h3,
body.app-page h4,
body.app-page .panel-header h2,
body.app-page .topbar-title {
    color: var(--heading-ink);
}

/* Nomes e informação-chave com identidade Serveasy */
.premium-table .table-title strong,
.prospect-row > div:first-child strong,
.action-row > div:first-child strong,
.record-person-copy h1,
.profile-hero-copy h1,
.account-identity-copy strong {
    color: var(--name-blue);
}

.premium-table .table-title:hover strong,
.prospect-row:hover > div:first-child strong,
.action-row:hover > div:first-child strong {
    color: var(--name-blue-hover);
}

.premium-table th {
    color: #506783;
    background: linear-gradient(180deg, #f7faff, #f1f6fb);
}

.premium-table td {
    color: #263951;
}

.premium-table tbody tr:hover td {
    background: #f4faff;
}

.premium-table .cell-primary-text,
.data-stack strong,
.record-data-label,
.field > span,
.settings-rule strong {
    color: #284a70;
}

.compact-link,
.premium-table td a:not(.btn):not(.table-action-btn):not(.archive-action):not(.converted-action) {
    color: var(--serveasy-blue-dark);
}

.panel-header p,
.table-title span,
.premium-table td > small,
.prospect-row span,
.action-row span {
    color: #647792;
}

/* Gestor moderno da ordem da sidebar */
.sidebar-order-panel {
    position: relative;
    margin-bottom: 16px;
    overflow: hidden;
}

.sidebar-order-panel::after {
    content: '';
    position: absolute;
    width: 190px;
    height: 190px;
    right: -85px;
    top: -105px;
    border-radius: 50%;
    pointer-events: none;
    background: radial-gradient(circle, rgba(49, 139, 54, .1), transparent 68%);
}

.sidebar-order-header {
    position: relative;
    z-index: 1;
    align-items: flex-start;
}

.settings-live-badge {
    display: inline-flex;
    min-height: 30px;
    align-items: center;
    padding: 0 11px;
    border: 1px solid rgba(49, 139, 54, .18);
    border-radius: 999px;
    background: rgba(49, 139, 54, .075);
    color: var(--serveasy-blue-dark);
    font-size: 10.5px;
    font-weight: 800;
    white-space: nowrap;
}

.sidebar-order-form {
    position: relative;
    z-index: 1;
}

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

.sidebar-order-group {
    padding: 14px;
    border: 1px solid var(--line-soft);
    border-radius: 16px;
    background: linear-gradient(180deg, #fbfdff, #f7fafe);
}

.sidebar-order-group-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 11px;
}

.sidebar-order-group-head strong,
.sidebar-order-group-head span {
    display: block;
}

.sidebar-order-group-head strong {
    color: var(--heading-ink);
    font-size: 13px;
}

.sidebar-order-group-head span,
.sidebar-order-group-head small {
    margin-top: 3px;
    color: var(--muted);
    font-size: 10.5px;
}

.sidebar-sort-list {
    display: grid;
    gap: 7px;
}

.sidebar-sort-item {
    display: grid;
    grid-template-columns: 30px 30px minmax(0, 1fr) auto;
    align-items: center;
    gap: 9px;
    min-height: 48px;
    padding: 7px 9px;
    border: 1px solid #dfe7f0;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 5px 13px rgba(15, 23, 42, .035);
    cursor: grab;
    transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease, opacity .16s ease;
}

.sidebar-sort-item:hover {
    border-color: rgba(49, 139, 54, .23);
    box-shadow: 0 8px 18px rgba(15, 23, 42, .055);
    transform: translateY(-1px);
}

.sidebar-sort-item.is-dragging {
    opacity: .42;
    border-color: var(--serveasy-blue);
    box-shadow: 0 12px 25px rgba(49, 139, 54, .14);
}

.sidebar-sort-list.is-sorting {
    border-radius: 13px;
    outline: 2px dashed rgba(49, 139, 54, .18);
    outline-offset: 5px;
}

.sort-drag-handle {
    display: grid;
    width: 30px;
    height: 30px;
    grid-template-columns: repeat(2, 3px);
    grid-auto-rows: 3px;
    align-content: center;
    justify-content: center;
    gap: 3px;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: #eff5fa;
    cursor: grab;
}

.sort-drag-handle span,
.sort-drag-handle::before,
.sort-drag-handle::after {
    content: '';
    display: block;
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: #8090a6;
    box-shadow: 6px 0 0 #8090a6;
}

.sort-position {
    display: grid;
    width: 30px;
    height: 30px;
    place-items: center;
    border-radius: 9px;
    background: rgba(49, 139, 54, .08);
    color: var(--serveasy-blue-dark);
    font-size: 10px;
    font-weight: 850;
}

.sidebar-sort-item > strong {
    color: #25415f;
    font-size: 12px;
}

.sort-mobile-actions {
    display: flex;
    gap: 4px;
}

.sort-mobile-actions button {
    display: grid;
    width: 28px;
    height: 28px;
    place-items: center;
    padding: 0;
    border: 1px solid #dfe7f0;
    border-radius: 8px;
    background: #fff;
    color: #52657d;
    font-size: 13px;
    font-weight: 800;
}

.sort-mobile-actions button:hover:not(:disabled) {
    border-color: rgba(49, 139, 54, .24);
    background: #f0faff;
    color: var(--serveasy-blue-dark);
}

.sort-mobile-actions button:disabled {
    opacity: .32;
    cursor: default;
}

.sidebar-order-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--line-soft);
}

.sidebar-order-footer > span {
    color: var(--muted);
    font-size: 11px;
}

.sidebar-order-buttons {
    display: flex;
    gap: 8px;
}

.sidebar-order-reset-form {
    position: absolute;
    right: 142px;
    bottom: 17px;
    z-index: 2;
}

/* Convertidos: linhas mais compactas e acções horizontais */
.converted-table .c-name { width: 9%; }
.converted-table .c-company { width: 9%; }
.converted-table .c-sector { width: 6%; }
.converted-table .c-date { width: 8%; }
.converted-table .c-origin { width: 7%; }
.converted-table .c-reason { width: 14%; }
.converted-table .c-owner { width: 7%; }
.converted-table .c-next { width: 12%; }
.converted-table .c-crm { width: 7%; }
.converted-table .c-lead { width: 5%; }
.converted-table .c-actions { width: 16%; }

.converted-table th,
.converted-table td {
    padding-top: 11px;
    padding-bottom: 11px;
}

.converted-table td {
    vertical-align: middle;
}

.converted-long-text {
    -webkit-line-clamp: 3;
}

.converted-actions-cell {
    vertical-align: bottom !important;
}

.converted-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: nowrap;
    gap: 5px;
    width: 100%;
}

.converted-actions .converted-action {
    display: inline-flex;
    min-width: 0;
    min-height: 30px;
    align-items: center;
    justify-content: center;
    padding: 0 8px;
    border: 1px solid #dbe4ee;
    border-radius: 9px;
    background: #fff;
    color: #425873;
    box-shadow: 0 4px 10px rgba(15, 23, 42, .035);
    font-size: 10px;
    font-weight: 800;
    white-space: nowrap;
}

.converted-actions .converted-action:hover {
    transform: translateY(-1px);
    box-shadow: 0 7px 15px rgba(15, 23, 42, .06);
}

.converted-actions .converted-action-open {
    border-color: var(--serveasy-blue);
    background: var(--serveasy-blue);
    color: #fff;
}

.converted-actions .converted-action-open:hover {
    border-color: var(--serveasy-blue-dark);
    background: var(--serveasy-blue-dark);
    color: #fff;
}

.converted-actions .converted-action-flow {
    border-color: rgba(49, 139, 54, .2);
    background: rgba(49, 139, 54, .07);
    color: var(--serveasy-blue-dark);
}

.converted-actions .converted-action-edit {
    background: #f8fafc;
}

.converted-actions .converted-action-revert {
    width: 30px;
    flex: 0 0 30px;
    padding: 0;
    border-color: rgba(220, 38, 38, .17);
    background: rgba(220, 38, 38, .045);
    color: #b42318;
    font-size: 16px;
}

/* Arquivo: acções com acabamento consistente */
.archive-table th:last-child,
.archive-table td:last-child {
    text-align: right;
}

.archive-actions-cell {
    vertical-align: middle;
}

.archive-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
}

.archive-action {
    display: inline-flex;
    min-height: 33px;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 0 10px;
    border: 1px solid #dce5ef;
    border-radius: 10px;
    background: #fff;
    color: #40536c;
    box-shadow: 0 4px 11px rgba(15, 23, 42, .04);
    font-size: 10.5px;
    font-weight: 800;
    transition: transform .16s ease, border-color .16s ease, background .16s ease, box-shadow .16s ease;
}

.archive-action svg {
    width: 14px;
    height: 14px;
    fill: currentColor;
}

.archive-action:hover {
    transform: translateY(-1px);
    box-shadow: 0 7px 16px rgba(15, 23, 42, .065);
}

.archive-action-open {
    border-color: var(--serveasy-blue);
    background: var(--serveasy-blue);
    color: #fff;
}

.archive-action-open:hover {
    border-color: var(--serveasy-blue-dark);
    background: var(--serveasy-blue-dark);
    color: #fff;
}

.archive-action-edit {
    border-color: rgba(49, 139, 54, .2);
    background: rgba(49, 139, 54, .055);
    color: var(--serveasy-blue-dark);
}

.archive-action-edit:hover {
    border-color: rgba(49, 139, 54, .34);
    background: rgba(49, 139, 54, .11);
}

@media (max-width: 1280px) {
    .converted-table-wrap {
        overflow-x: auto;
    }

    .converted-table {
        min-width: 1280px;
    }
}

@media (max-width: 900px) {
    .sidebar-order-grid {
        grid-template-columns: 1fr;
    }

    .sidebar-order-reset-form {
        position: static;
        margin-top: 10px;
    }

    .sidebar-order-footer {
        align-items: flex-start;
        flex-direction: column;
    }
}

@media (max-width: 560px) {
    .sidebar-order-header {
        gap: 10px;
        flex-direction: column;
    }

    .sidebar-sort-item {
        grid-template-columns: 28px 28px minmax(0, 1fr) auto;
        gap: 7px;
    }

    .sort-drag-handle {
        display: none;
    }

    .sidebar-sort-item {
        grid-template-columns: 28px minmax(0, 1fr) auto;
        cursor: default;
    }
}

/* v0.7.1 — Botões da ordem da sidebar */
.sidebar-order-buttons{
    display:flex;
    align-items:center;
    gap:14px;
}
.sidebar-order-buttons .sidebar-order-action{
    width:190px;
    min-width:190px;
    min-height:50px;
    justify-content:center;
}
.sidebar-order-reset-form{
    display:none;
}
@media (max-width:700px){
    .sidebar-order-buttons{
        width:100%;
        flex-direction:column;
        gap:10px;
    }
    .sidebar-order-buttons .sidebar-order-action{
        width:100%;
        min-width:0;
    }
}

/* v0.7.3 — Modais adaptados à altura do ecrã */
.app-modal-dialog{
    display:flex;
    flex-direction:column;
    max-height:calc(100vh - 44px);
    max-height:calc(100dvh - 44px);
    overflow:hidden;
}
.app-modal-dialog > form{
    display:flex;
    flex:1 1 auto;
    min-height:0;
    flex-direction:column;
    overflow:hidden;
}
.app-modal-header,
.app-modal-actions{
    flex:0 0 auto;
}
.app-modal-body{
    flex:1 1 auto;
    min-height:0;
    overflow-y:auto;
    overscroll-behavior:contain;
    scrollbar-gutter:stable;
}
.app-modal-actions{
    position:relative;
    z-index:2;
    background:#fff;
    box-shadow:0 -10px 24px rgba(18,42,73,.05);
}
@media (max-width:640px){
    .app-modal-dialog{
        max-height:calc(100vh - 20px);
        max-height:calc(100dvh - 20px);
        overflow:hidden;
    }
}


/* =========================================================
   Serveasy Prospect Desk v0.7.6
   Diagnóstico compacto · Perfil da sidebar simplificado
   ========================================================= */

/* O resumo do diagnóstico deve ser compacto e respirar antes da tabela. */
.diagnostic-hero {
    min-height: 0;
    justify-content: flex-start;
    margin-bottom: 18px;
    padding: 18px 22px;
}

.diagnostic-hero h2 {
    margin-top: 12px;
    font-size: 24px;
    line-height: 1.1;
}

.diagnostic-hero p {
    margin-bottom: 0;
}

/* O cartão do utilizador é todo clicável; não precisa de um segundo botão visual. */
.user-mini {
    padding-right: 12px;
}

@media (max-width: 720px) {
    .diagnostic-hero {
        margin-bottom: 14px;
        padding: 16px 18px;
    }

    .diagnostic-hero h2 {
        font-size: 22px;
    }
}


/* =========================================================
   Ferrão Prospect v0.20.0 — rebranding Ferrão Soluções
   Identidade integrada sem alterar a paleta funcional da UI.
   ========================================================= */
.auth-logo-wrap {
    margin-bottom: 18px;
}

.auth-logo {
    width: 104px;
    height: 104px;
    object-fit: contain;
    background: transparent;
}

.auth-brand-owner {
    display: block;
    margin: -1px 0 12px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .075em;
    text-transform: uppercase;
}

.brand-logo-wrap {
    border: 0;
    background: transparent;
    box-shadow: none;
}

.brand-logo {
    width: 44px;
    height: 44px;
    padding: 0;
    object-fit: contain;
    background: transparent;
    box-shadow: none;
}

/* Ferrão Prospect v0.42.3 — respiro consistente entre cartões principais das Definições. */
.settings-page .main-content > .panel + .panel {
    margin-top: 22px;
}

/* Ferrão Prospect v0.21.0 — Estados configuráveis */
.status-settings-panel {
    margin-top: 22px;
}
.status-settings-header {
    align-items: flex-start;
}
.status-settings-create {
    display: grid;
    gap: 16px;
    padding: 18px;
    margin-bottom: 18px;
    border: 1px solid var(--border, #e5e7eb);
    border-radius: 16px;
    background: rgba(248,250,252,.72);
}
.status-settings-create-copy {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.status-settings-create-copy strong {
    font-size: .98rem;
    color: var(--text, #0f172a);
}
.status-settings-create-copy span,
.status-admin-identity small,
.status-settings-footnote {
    color: var(--muted, #64748b);
    font-size: .82rem;
    line-height: 1.5;
}
.status-create-form {
    display: grid;
    grid-template-columns: minmax(220px, 1.5fr) minmax(150px, .8fr) minmax(150px, .8fr) auto;
    gap: 12px;
    align-items: end;
}
.status-admin-list {
    display: grid;
    gap: 10px;
}
.status-admin-row {
    border: 1px solid var(--border, #e5e7eb);
    border-radius: 14px;
    background: #fff;
    overflow: hidden;
}
.status-admin-edit-form {
    display: grid;
    grid-template-columns: minmax(220px, 1.45fr) minmax(180px, 1fr) minmax(135px, .72fr) minmax(130px, .72fr) 92px auto auto;
    gap: 10px;
    align-items: end;
    padding: 14px;
}
.status-admin-identity {
    align-self: center;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}
.status-admin-identity > div {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.status-admin-identity code {
    max-width: 230px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: .72rem;
    color: #64748b;
    background: transparent;
}
.status-admin-identity small {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.status-order-field input {
    text-align: center;
}
.status-active-toggle {
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 0 10px;
    border: 1px solid var(--border, #e5e7eb);
    border-radius: 10px;
    font-size: .82rem;
    font-weight: 600;
    color: #334155;
    background: #fff;
}
.status-active-toggle input {
    accent-color: #15803d;
}
.status-save-button {
    min-height: 42px;
    white-space: nowrap;
}
.status-admin-secondary-actions {
    min-height: 38px;
    padding: 8px 14px 10px;
    border-top: 1px solid rgba(226,232,240,.8);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 14px;
    background: rgba(248,250,252,.55);
}
.status-admin-secondary-actions form {
    margin: 0;
}
.status-text-action {
    appearance: none;
    border: 0;
    background: transparent;
    padding: 3px 0;
    font: inherit;
    font-size: .78rem;
    font-weight: 650;
    color: #475569;
    cursor: pointer;
}
.status-text-action:hover {
    color: #0f172a;
}
.status-text-action.is-danger {
    color: #b91c1c;
}
.status-default-note {
    font-size: .76rem;
    font-weight: 700;
    color: #15803d;
}
.status-settings-footnote {
    margin-top: 14px;
    padding: 12px 14px;
    border-radius: 12px;
    background: rgba(241,245,249,.72);
}
.status-settings-footnote strong {
    color: #334155;
}
@media (max-width: 1180px) {
    .status-create-form {
        grid-template-columns: 1fr 1fr 1fr;
    }
    .status-create-form .btn {
        grid-column: 1 / -1;
        justify-self: start;
    }
    .status-admin-edit-form {
        grid-template-columns: 1.4fr 1fr 1fr 90px;
    }
    .status-admin-identity {
        grid-column: 1 / -1;
    }
    .status-active-toggle,
    .status-save-button {
        align-self: end;
    }
}
@media (max-width: 760px) {
    .status-create-form,
    .status-admin-edit-form {
        grid-template-columns: 1fr;
    }
    .status-create-form .btn,
    .status-admin-identity {
        grid-column: auto;
    }
    .status-active-toggle {
        justify-content: flex-start;
    }
    .status-save-button,
    .status-create-form .btn {
        width: 100%;
        justify-content: center;
    }
    .status-admin-secondary-actions {
        justify-content: space-between;
        flex-wrap: wrap;
    }
}

/* Ferrão Prospect v0.22.0 — Campos configuráveis da ficha */
.field-settings-panel {
    overflow: hidden;
}
.field-settings-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 18px;
    padding: 14px 18px;
    margin: 0 0 14px;
    border: 1px solid var(--border, #e5e7eb);
    border-radius: 14px;
    background: rgba(248, 250, 252, .72);
    font-size: 12px;
    color: var(--muted, #64748b);
}
.field-settings-legend strong { color: var(--text, #0f172a); }
.field-settings-list {
    display: grid;
    gap: 10px;
}
.field-settings-row {
    display: grid;
    grid-template-columns: minmax(150px, .9fr) minmax(180px, 1.15fr) minmax(160px, .95fr) 88px minmax(260px, 1.35fr);
    gap: 12px;
    align-items: end;
    padding: 14px;
    border: 1px solid var(--border, #e5e7eb);
    border-radius: 14px;
    background: #fff;
}
.field-settings-identity {
    align-self: center;
    min-width: 0;
}
.field-settings-identity strong,
.field-settings-identity code {
    display: block;
}
.field-settings-identity strong {
    margin-bottom: 5px;
    font-size: 13px;
    color: var(--text, #0f172a);
}
.field-settings-identity code {
    width: fit-content;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 10px;
    color: var(--muted, #64748b);
    background: #f1f5f9;
    border-radius: 6px;
    padding: 3px 6px;
}
.field-settings-row .field { margin: 0; }
.field-settings-order input { text-align: center; }
.field-settings-toggles {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 7px;
    align-self: center;
}
.field-settings-toggles label {
    min-height: 39px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 7px;
    border: 1px solid var(--border, #e5e7eb);
    border-radius: 10px;
    background: #f8fafc;
    font-size: 11px;
    font-weight: 700;
    color: #475569;
    cursor: pointer;
}
.field-settings-toggles input { margin: 0; }
.field-settings-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border, #e5e7eb);
}
.field-settings-footer > div { display: grid; gap: 4px; }
.field-settings-footer strong { font-size: 13px; }
.field-settings-footer span { font-size: 12px; color: var(--muted, #64748b); }
.form-section-closure { border-style: dashed; }

@media (max-width: 1180px) {
    .field-settings-row {
        grid-template-columns: minmax(150px, .9fr) minmax(180px, 1.2fr) minmax(160px, 1fr) 88px;
    }
    .field-settings-toggles { grid-column: 1 / -1; }
}
@media (max-width: 760px) {
    .field-settings-row { grid-template-columns: 1fr 1fr; }
    .field-settings-identity { grid-column: 1 / -1; }
    .field-settings-toggles { grid-column: 1 / -1; }
    .field-settings-footer { align-items: stretch; flex-direction: column; }
    .field-settings-footer .btn { width: 100%; }
}
@media (max-width: 520px) {
    .field-settings-row { grid-template-columns: 1fr; }
    .field-settings-identity,
    .field-settings-toggles { grid-column: auto; }
    .field-settings-toggles { grid-template-columns: 1fr; }
}

/* Ferrão Prospect v0.23.0 — Campos personalizados */
.custom-field-create-box {
    margin: 0 0 18px;
    padding: 18px;
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 16px;
    background: var(--surface-soft, #f8fafc);
    display: grid;
    gap: 14px;
}
.custom-field-create-copy { display: grid; gap: 4px; }
.custom-field-create-copy strong { font-size: 14px; color: var(--text, #0f172a); }
.custom-field-create-copy span { font-size: 12px; color: var(--muted, #64748b); }
.custom-field-create-form {
    display: grid;
    grid-template-columns: 1.15fr .8fr .9fr 1.15fr;
    gap: 12px;
    align-items: end;
}
.custom-field-create-form .field { margin: 0; }
.custom-field-options-create { grid-column: 1 / 3; }
.custom-field-create-toggles {
    grid-column: 3 / 5;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}
.custom-field-create-toggles label,
.field-settings-custom-actions {
    min-height: 42px;
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 10px;
    background: var(--surface, #fff);
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 11px;
    font-size: 12px;
    color: var(--muted, #64748b);
}
.custom-field-create-form > .btn { min-height: 42px; }
.field-settings-row.is-custom-field {
    background: linear-gradient(180deg, rgba(248,250,252,.95), rgba(255,255,255,.98));
}
.field-settings-identity small {
    display: block;
    margin-top: 4px;
    font-size: 11px;
    color: var(--muted, #64748b);
}
.field-settings-options { grid-column: span 2; }
.field-settings-custom-actions {
    grid-column: 1 / -1;
    justify-content: flex-end;
    min-height: 36px;
    background: transparent;
    border-style: dashed;
}
.field-settings-custom-actions span { margin-right: auto; }
.field-hint {
    display: block;
    margin-top: 5px;
    color: var(--muted, #64748b);
    font-size: 11px;
}
.custom-field-input select[multiple] { min-height: 108px; }
.record-custom-fields-list { display: grid; gap: 18px; }
.record-custom-field-group { display: grid; gap: 10px; }
.record-custom-field-group + .record-custom-field-group {
    padding-top: 15px;
    border-top: 1px solid var(--border, #e2e8f0);
}
.record-custom-field-group-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--muted, #64748b);
}
.record-custom-field-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}
.record-custom-field-item {
    min-width: 0;
    padding: 11px 12px;
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 12px;
    background: var(--surface-soft, #f8fafc);
    display: grid;
    gap: 4px;
}
.record-custom-field-item.is-wide { grid-column: 1 / -1; }
.record-custom-field-item > span { font-size: 11px; color: var(--muted, #64748b); }
.record-custom-field-item > strong,
.record-custom-field-item > a,
.record-custom-field-item > p { margin: 0; font-size: 13px; overflow-wrap: anywhere; }
.record-custom-field-item > strong.is-empty { color: var(--muted, #94a3b8); font-weight: 500; }

@media (max-width: 1100px) {
    .custom-field-create-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .custom-field-options-create,
    .custom-field-create-toggles { grid-column: 1 / -1; }
}
@media (max-width: 700px) {
    .custom-field-create-form,
    .custom-field-create-toggles,
    .record-custom-field-grid { grid-template-columns: 1fr; }
    .field-settings-options,
    .record-custom-field-item.is-wide { grid-column: auto; }
}

/* =========================================================
   Ferrão Prospect v0.43.1 — Definições por áreas em barra horizontal
   Mantém uma área visível de cada vez sem retirar largura útil aos
   formulários e reforça a grelha dos Catálogos comerciais.
   ========================================================= */
.settings-workspace {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 18px;
    align-items: start;
    margin-top: 22px;
}

.settings-area-nav {
    position: sticky;
    top: 82px;
    z-index: 8;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 8px;
    padding: 8px;
    border: 1px solid var(--border, #dbe3ee);
    border-radius: 17px;
    background: rgba(255,255,255,.96);
    box-shadow: 0 12px 30px rgba(15,23,42,.055);
    backdrop-filter: blur(12px);
}

.settings-area-nav-link {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    min-height: 44px;
    padding: 10px 14px;
    border: 1px solid transparent;
    border-radius: 11px;
    color: var(--text, #0f172a);
    font-size: 13px;
    font-weight: 800;
    line-height: 1.2;
    text-align: center;
    text-decoration: none;
    white-space: nowrap;
    transition: border-color .16s ease, background .16s ease, box-shadow .16s ease, color .16s ease, transform .16s ease;
}

.settings-area-nav-link:hover {
    border-color: rgba(46,139,55,.18);
    background: rgba(46,139,55,.045);
    color: var(--primary-dark, #176b25);
    transform: translateY(-1px);
}

.settings-area-nav-link.is-active,
.settings-area-nav-link[aria-current="page"] {
    border-color: rgba(46,139,55,.24);
    background: rgba(46,139,55,.095);
    color: var(--primary-dark, #176b25);
    box-shadow: inset 0 -3px 0 var(--primary, #2e8b37), 0 6px 15px rgba(46,139,55,.07);
}

.settings-workspace-content {
    min-width: 0;
}

.settings-area-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    padding: 17px 20px;
    margin-bottom: 18px;
    border: 1px solid var(--border, #dbe3ee);
    border-radius: 18px;
    background: rgba(248,250,252,.76);
}

.settings-area-heading > div {
    display: grid;
    gap: 3px;
    min-width: 0;
}

.settings-area-heading h2 {
    margin: 0;
    color: var(--text, #0f172a);
    font-size: clamp(20px, 2vw, 25px);
    line-height: 1.15;
}

.settings-area-heading p {
    margin: 0;
    color: var(--muted, #64748b);
    font-size: 13px;
    line-height: 1.5;
}

.settings-workspace-content > [data-settings-area] {
    margin-top: 22px !important;
}

.settings-workspace-content > [data-settings-area].is-first-settings-area-panel {
    margin-top: 0 !important;
}

.settings-workspace.is-settings-area-enhanced [data-settings-area][hidden] {
    display: none !important;
}

/* Catálogos: não reutilizar a grelha larga dos estados para formulários curtos. */
.settings-catalogs-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
}

.settings-catalogs-grid .settings-alerts-section {
    min-width: 0;
}

.settings-catalogs-grid .settings-alerts-section-head {
    min-height: 66px;
}

.settings-catalogs-grid .settings-alerts-section-head h3 {
    font-size: 18px;
    line-height: 1.25;
}

.settings-catalogs-grid .settings-alerts-section-head p {
    max-width: 68ch;
    font-size: 12px;
    line-height: 1.5;
}

.catalog-create-form {
    grid-template-columns: minmax(240px, 1fr) auto;
    gap: 12px;
    align-items: end;
}

.catalog-create-form .btn {
    min-width: 150px;
    white-space: nowrap;
}

.settings-catalogs-grid .status-admin-list {
    margin-top: 16px;
}

.settings-catalogs-grid .status-admin-card {
    min-width: 0;
    overflow: hidden;
    border: 1px solid var(--border, #e5e7eb);
    border-radius: 14px;
    background: #fff;
}

.catalog-admin-main-form {
    display: grid;
    grid-template-columns: minmax(180px, 1fr) 92px auto auto;
    gap: 10px;
    align-items: end;
    padding: 13px;
}

.catalog-admin-main-form .field {
    min-width: 0;
    margin: 0;
}

.catalog-admin-main-form .field small {
    display: block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.settings-catalogs-grid .status-admin-secondary-actions {
    margin: 0;
}

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

    .settings-catalogs-grid .settings-alerts-section-head {
        min-height: 0;
    }

    .catalog-admin-main-form {
        grid-template-columns: minmax(240px, 1fr) 110px auto auto;
    }
}

@media (max-width: 980px) {
    .settings-area-nav {
        position: static;
        display: flex;
        gap: 7px;
        overflow-x: auto;
        scrollbar-width: thin;
    }

    .settings-area-nav-link {
        flex: 0 0 auto;
        min-width: 145px;
    }
}

@media (max-width: 760px) {
    .settings-workspace {
        gap: 14px;
        margin-top: 14px;
    }

    .settings-area-nav {
        padding: 7px;
        border-radius: 15px;
    }

    .settings-area-nav-link {
        min-width: 132px;
        min-height: 40px;
        padding: 9px 11px;
        font-size: 12px;
    }

    .settings-area-heading {
        display: grid;
        gap: 10px;
        padding: 15px 16px;
        margin-bottom: 14px;
        border-radius: 16px;
    }

    .settings-area-heading .settings-live-badge {
        justify-self: start;
    }

    .settings-workspace-content > [data-settings-area] {
        margin-top: 14px !important;
    }

    .settings-workspace-content > [data-settings-area].is-first-settings-area-panel {
        margin-top: 0 !important;
    }

    .catalog-create-form,
    .catalog-admin-main-form {
        grid-template-columns: 1fr;
    }

    .catalog-create-form .btn,
    .catalog-admin-main-form .btn,
    .catalog-admin-main-form .status-active-toggle {
        width: 100%;
        justify-content: center;
    }
}


/* ---------------------------------------------------------
   Exportações operacionais v0.44.0
   --------------------------------------------------------- */
.exports-page .export-history-panel,
.exports-page .export-detail-hero,
.exports-page .export-detail-list-panel {
    border-color: var(--line-soft);
    box-shadow: var(--shadow-card);
}

.export-history-head {
    align-items: flex-start;
}

.export-filter-bar {
    display: grid;
    grid-template-columns: minmax(260px, 1fr) minmax(170px, 220px) auto;
    gap: 12px;
    align-items: end;
    margin: 18px 0;
    padding: 14px;
    border: 1px solid var(--line-soft);
    border-radius: 15px;
    background: #f8fafc;
}

.export-filter-bar label {
    display: grid;
    gap: 6px;
    min-width: 0;
}

.export-filter-bar label > span {
    color: var(--ink);
    font-size: 12px;
    font-weight: 800;
}

.export-filter-bar input,
.export-filter-bar select {
    width: 100%;
    min-height: 44px;
}

.export-filter-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.export-table-wrap {
    margin-top: 6px;
}

.export-history-table .cell-actions,
.export-items-table .cell-actions {
    width: 1%;
    white-space: nowrap;
    text-align: right;
}

.export-detail-toolbar {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 14px;
}

.export-detail-hero {
    background:
        radial-gradient(circle at 92% 0, rgba(49, 139, 54, .10), transparent 29%),
        #fff;
}

.export-detail-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
}

.export-detail-heading h2 {
    margin: 4px 0 5px;
    overflow-wrap: anywhere;
}

.export-detail-heading p {
    margin: 0;
    color: var(--muted);
}

.export-format-badge {
    flex: 0 0 auto;
}

.export-detail-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-top: 20px;
}

.export-detail-stat {
    min-width: 0;
    padding: 14px 15px;
    border: 1px solid var(--line-soft);
    border-radius: 14px;
    background: #fbfdff;
}

.export-detail-stat span,
.export-detail-stat strong {
    display: block;
}

.export-detail-stat span {
    color: var(--muted);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .05em;
    text-transform: uppercase;
}

.export-detail-stat strong {
    margin-top: 6px;
    color: var(--ink);
    font-size: 14px;
    overflow-wrap: anywhere;
}

.export-filter-context {
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid var(--line-soft);
}

.export-filter-context > strong {
    display: block;
    margin-bottom: 9px;
    color: var(--ink);
    font-size: 12px;
}

.export-filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.export-filter-chips span {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 5px 10px;
    border: 1px solid rgba(49, 139, 54, .18);
    border-radius: 999px;
    background: rgba(49, 139, 54, .07);
    color: var(--ink);
    font-size: 11px;
    font-weight: 700;
}

.export-detail-list-panel {
    margin-top: 18px;
}

.export-items-table .table-link {
    color: var(--ink);
    text-decoration: none;
}

.export-items-table .table-link:hover {
    text-decoration: underline;
}

.export-items-table .muted-text {
    color: var(--muted);
    font-size: 12px;
}

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

@media (max-width: 760px) {
    .export-filter-bar {
        grid-template-columns: 1fr;
    }

    .export-filter-actions,
    .export-detail-toolbar,
    .export-detail-heading {
        align-items: stretch;
        flex-direction: column;
    }

    .export-filter-actions .btn,
    .export-detail-toolbar .btn {
        width: 100%;
        justify-content: center;
    }

    .export-detail-grid {
        grid-template-columns: 1fr;
    }
}

/* Ferrão Prospect v0.48.0 — reposição explícita de predefinições */
.settings-reset-strip {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin: 0 0 18px;
    padding: 14px 16px;
    border: 1px solid var(--border, #e5e7eb);
    border-radius: 14px;
    background: rgba(248,250,252,.72);
}
.settings-reset-strip > div {
    min-width: 0;
    display: grid;
    gap: 3px;
}
.settings-reset-strip strong {
    color: var(--text, #0f172a);
    font-size: .9rem;
}
.settings-reset-strip span {
    color: var(--muted, #64748b);
    font-size: .8rem;
    line-height: 1.45;
}
.settings-reset-strip .btn { flex: 0 0 auto; }
@media (max-width: 760px) {
    .settings-reset-strip { align-items: stretch; flex-direction: column; }
    .settings-reset-strip .btn { width: 100%; }
}
