:root {
    --lorient-green: #5aa832;
    --lorient-lime: #8cc63f;
    --lorient-teal: #0f9d8a;
    --lorient-blue: #0b67b0;
    --lorient-red: #d92d20;
    --lorient-amber: #b7791f;
    --primary: #0b67b0;
    --primary-hover: #09579a;
    --primary-soft: #e8f1fb;
    --primary-ring: rgba(11, 103, 176, .16);
    --bg-body: #f5f7fa;
    --bg-card: #ffffff;
    --bg-subtle: #f8fafc;
    --bg-sidebar: #ffffff;
    --text-dark: #1f2937;
    --text-body: #374151;
    --text-muted: #6b7280;
    --text-faint: #9ca3af;
    --border-color: #e3e8ef;
    --border-soft: #eef1f5;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow-sm: 0 1px 2px rgba(16, 24, 40, .04);
    --shadow-md: 0 4px 14px rgba(16, 24, 40, .06);
    --shadow-lg: 0 18px 40px rgba(16, 24, 40, .14);
    --sidebar-width: 256px;
    --ok-bg: #eaf6ec;
    --ok-border: #b9e0c0;
    --ok-text: #1f6b35;
    --err-bg: #fdecec;
    --err-border: #f5c2c2;
    --err-text: #b42318;
    --warn-bg: #fff7e6;
    --warn-border: #f5d9a0;
    --warn-text: #8a5a00;
    --info-bg: #e8f1fb;
    --info-border: #bcd5f0;
    --info-text: #0b4f8a;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

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

body {
    font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
    background: var(--bg-body);
    color: var(--text-dark);
    font-size: 14px;
    line-height: 1.45;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
h1, h2, h3, h4 { letter-spacing: -.015em; color: var(--text-dark); }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

.skip-link {
    position: absolute;
    left: -9999px;
    top: 8px;
    z-index: 100;
    background: var(--primary);
    color: #fff;
    padding: .5rem 1rem;
    border-radius: var(--radius-sm);
}
.skip-link:focus { left: 8px; }

.app-shell { display: flex; min-height: 100vh; }

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    z-index: 60;
    transition: transform .2s ease;
}

.sidebar::before {
    content: '';
    display: block;
    height: 3px;
    background: linear-gradient(90deg, var(--lorient-lime), #16b3a3 45%, var(--lorient-blue));
    flex: none;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: .7rem;
    padding: 1rem 1.15rem;
    text-decoration: none;
    border-bottom: 1px solid var(--border-soft);
    flex: none;
}
.sidebar-brand:hover { text-decoration: none; }
.sidebar-brand img { width: 40px; height: 40px; }
.brand-name { font-size: 1.05rem; font-weight: 800; line-height: 1.1; color: var(--text-dark); }
.brand-sub { font-size: .74rem; color: var(--text-muted); font-weight: 500; }

.sidebar-nav { flex: 1; overflow-y: auto; padding: .6rem .7rem 1.5rem; scrollbar-width: thin; }

.nav-group-title {
    font-size: .68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--text-faint);
    padding: .95rem .65rem .35rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .5rem .65rem;
    border-radius: var(--radius-sm);
    color: var(--text-body);
    font-size: .875rem;
    font-weight: 500;
    transition: background .15s, color .15s;
}
.nav-link i { width: 18px; text-align: center; font-size: .9rem; color: var(--text-muted); transition: color .15s; }
.nav-link:hover { background: var(--bg-subtle); color: var(--text-dark); text-decoration: none; }
.nav-link.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.nav-link.active i { color: var(--primary); }
.nav-link .nav-count {
    margin-left: auto;
    font-size: .7rem;
    font-weight: 700;
    background: var(--lorient-red);
    color: #fff;
    border-radius: 999px;
    padding: 0 .45rem;
    line-height: 1.5;
}

.sidebar-foot { padding: .8rem 1.15rem; border-top: 1px solid var(--border-soft); font-size: .72rem; color: var(--text-faint); flex: none; }

.main-area { flex: 1; margin-left: var(--sidebar-width); min-width: 0; display: flex; flex-direction: column; }

.topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(255, 255, 255, .96);
    backdrop-filter: blur(6px);
    border-bottom: 1px solid var(--border-color);
}

.topbar-inner { height: 60px; display: flex; align-items: center; gap: 1rem; padding: 0 1.5rem; }

.menu-toggle {
    display: none;
    width: 38px;
    height: 38px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: #fff;
    color: var(--text-body);
    cursor: pointer;
}

.global-search { flex: 1; max-width: 520px; position: relative; }
.global-search i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-faint); font-size: .85rem; }
.global-search input {
    width: 100%;
    height: 38px;
    border: 1px solid var(--border-color);
    border-radius: 999px;
    background: var(--bg-subtle);
    padding: 0 2.6rem 0 2.2rem;
    font: inherit;
    font-size: .875rem;
    color: var(--text-dark);
    outline: none;
    transition: border-color .15s, box-shadow .15s, background .15s;
}
.global-search input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-ring); background: #fff; }
.global-search kbd {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    font: 600 .7rem 'Inter', sans-serif;
    color: var(--text-faint);
    border: 1px solid var(--border-color);
    border-radius: 5px;
    padding: 0 .35rem;
    background: #fff;
}

.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: .5rem; }

.icon-btn {
    position: relative;
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: var(--radius-sm);
    color: var(--text-body);
    border: 1px solid transparent;
    background: transparent;
    cursor: pointer;
}
.icon-btn:hover { background: var(--bg-subtle); text-decoration: none; }
.icon-btn .dot {
    position: absolute;
    top: 4px;
    right: 3px;
    min-width: 17px;
    height: 17px;
    padding: 0 4px;
    border-radius: 999px;
    background: var(--lorient-red);
    color: #fff;
    font-size: .64rem;
    font-weight: 700;
    display: grid;
    place-items: center;
    border: 2px solid #fff;
}

.user-menu { position: relative; }
.user-menu summary { list-style: none; }
.user-menu summary::-webkit-details-marker { display: none; }
.user-trigger { display: flex; align-items: center; gap: .6rem; padding: .3rem .5rem; border-radius: var(--radius-sm); cursor: pointer; }
.user-trigger:hover { background: var(--bg-subtle); }
.avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, #16b3a3, #0b8fb0);
    color: #fff;
    display: grid;
    place-items: center;
    font-weight: 600;
    font-size: .85rem;
    flex: none;
}
.avatar.sm { width: 26px; height: 26px; font-size: .7rem; }
.user-name { font-size: .86rem; font-weight: 700; line-height: 1.15; }
.user-role { font-size: .72rem; color: var(--text-muted); }
.user-trigger .fa-chevron-down { font-size: .65rem; color: var(--text-muted); transition: transform .15s; }
.user-menu[open] .fa-chevron-down { transform: rotate(180deg); }
.dropdown {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    min-width: 210px;
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
    padding: .35rem;
    z-index: 70;
}
.dropdown a, .dropdown button {
    display: flex;
    align-items: center;
    gap: .6rem;
    width: 100%;
    padding: .55rem .7rem;
    border-radius: 6px;
    font: inherit;
    font-size: .86rem;
    color: var(--text-body);
    background: none;
    border: 0;
    cursor: pointer;
    text-align: left;
}
.dropdown a:hover, .dropdown button:hover { background: var(--bg-subtle); text-decoration: none; }
.dropdown .danger { color: var(--lorient-red); }
.dropdown .danger:hover { background: #fdecec; }

.content { flex: 1; padding: 0 1.5rem 2.5rem; max-width: 1640px; width: 100%; margin: 0 auto; }

.page-head { padding: 1.6rem 0 1rem; display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.page-head h1 { font-size: 1.6rem; font-weight: 700; letter-spacing: -.02em; }
.page-head p { margin-top: .25rem; color: var(--text-muted); font-size: .92rem; }
.breadcrumb { font-size: .78rem; color: var(--text-muted); margin-bottom: .35rem; display: flex; gap: .4rem; flex-wrap: wrap; }
.breadcrumb a { color: var(--text-muted); }
.page-actions { display: flex; gap: .5rem; flex-wrap: wrap; }

.app-footer { border-top: 1px solid var(--border-color); padding: 1.1rem 1.5rem; text-align: center; font-size: .74rem; color: var(--text-muted); background: #fff; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    height: 38px;
    padding: 0 1rem;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    font: inherit;
    font-size: .86rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
    transition: background .15s, border-color .15s, box-shadow .15s, color .15s;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-success { background: var(--lorient-green); color: #fff; }
.btn-success:hover { background: #4b9128; }
.btn-teal { background: var(--lorient-teal); color: #fff; }
.btn-teal:hover { background: #0c8676; }
.btn-danger { background: #fff; color: var(--lorient-red); border-color: var(--err-border); }
.btn-danger:hover { background: var(--err-bg); }
.btn-outline { background: #fff; color: var(--text-dark); border-color: var(--border-color); }
.btn-outline:hover { background: var(--bg-subtle); border-color: #cfd6df; }
.btn-ghost { background: transparent; color: var(--text-body); }
.btn-ghost:hover { background: var(--bg-subtle); }
.btn-sm { height: 30px; padding: 0 .7rem; font-size: .8rem; }
.btn-xs { height: 26px; padding: 0 .55rem; font-size: .75rem; border-radius: 6px; }
.btn-block { width: 100%; }
.btn[disabled], .btn.is-loading { opacity: .65; pointer-events: none; }
.btn.is-loading::after {
    content: '';
    width: 13px;
    height: 13px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--primary-ring); }

.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 1.2rem 1.3rem;
    min-width: 0;
}
.card + .card { margin-top: 1.1rem; }
.card-title { display: flex; justify-content: space-between; align-items: center; gap: .75rem; margin-bottom: .9rem; font-size: .98rem; font-weight: 700; flex-wrap: wrap; }
.card-title small { font-weight: 500; color: var(--text-muted); font-size: .78rem; }
.card-flush { padding: 0; }
.card-flush .card-title { padding: 1rem 1.2rem 0; }

.grid { display: grid; gap: 1.1rem; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-main-side { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }
.grid-side-main { grid-template-columns: 360px minmax(0, 1fr); align-items: start; }
.stack { display: flex; flex-direction: column; gap: 1.1rem; }
.row { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.row-between { display: flex; gap: .6rem; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.mt-1 { margin-top: .5rem; } .mt-2 { margin-top: 1rem; } .mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: .5rem; } .mb-2 { margin-bottom: 1rem; }
.text-muted { color: var(--text-muted); }
.text-small { font-size: .8rem; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.nowrap { white-space: nowrap; }
.strong { font-weight: 700; }
.positive { color: var(--lorient-teal); font-weight: 600; }
.negative { color: #dc2626; font-weight: 600; }
.hidden { display: none !important; }

.kpi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: .9rem; }
.kpi-box {
    --tint: var(--lorient-teal);
    position: relative;
    overflow: hidden;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 1rem 1.15rem;
    min-height: 100px;
    transition: box-shadow .2s, transform .2s;
    display: block;
    color: inherit;
}
a.kpi-box:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); text-decoration: none; }
.kpi-box::before {
    content: '';
    position: absolute;
    inset: 0 0 auto auto;
    width: 55%;
    height: 100%;
    background-image: radial-gradient(color-mix(in srgb, var(--tint) 22%, transparent) 1.2px, transparent 1.6px);
    background-size: 14px 14px;
    -webkit-mask-image: linear-gradient(to left, #000, transparent);
    mask-image: linear-gradient(to left, #000, transparent);
    pointer-events: none;
}
.kpi-box > * { position: relative; }
.kpi-box.green { --tint: var(--lorient-green); }
.kpi-box.teal { --tint: var(--lorient-teal); }
.kpi-box.blue { --tint: var(--lorient-blue); }
.kpi-box.red { --tint: var(--lorient-red); }
.kpi-box.amber { --tint: var(--lorient-amber); }
.kpi-box.gray { --tint: #64748b; }
.kpi-box .label { font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--tint); line-height: 1.3; }
.kpi-box .val { font-size: 1.45rem; font-weight: 700; margin-top: 4px; color: var(--text-dark); letter-spacing: -.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-box .sub { font-size: .75rem; font-weight: 500; margin-top: 3px; color: var(--text-muted); }

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: .86rem; }
.table th {
    background: var(--bg-subtle);
    color: var(--text-muted);
    font-size: .7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
    padding: .65rem .8rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}
.table th a { color: inherit; }
.table th:first-child { border-top-left-radius: var(--radius-sm); }
.table th:last-child { border-top-right-radius: var(--radius-sm); }
.table td { padding: .7rem .8rem; border-bottom: 1px solid var(--border-soft); color: var(--text-dark); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #fafbfd; }
.table tfoot td { font-weight: 700; background: var(--bg-subtle); border-top: 2px solid var(--border-color); padding: .7rem .8rem; }
.table .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.table .actions { text-align: right; white-space: nowrap; }
.table .title-cell a { font-weight: 600; color: var(--text-dark); }
.table .title-cell small { display: block; color: var(--text-muted); font-size: .76rem; }
.table-compact td, .table-compact th { padding: .45rem .6rem; }

.empty-state { text-align: center; padding: 2.4rem 1rem; color: var(--text-muted); }
.empty-state i { font-size: 1.8rem; color: var(--text-faint); margin-bottom: .6rem; display: block; }
.empty-state strong { display: block; color: var(--text-dark); margin-bottom: .25rem; font-size: .95rem; }

.badge {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    padding: .15rem .6rem;
    border: 1px solid var(--border-color);
    border-radius: 999px;
    background: #fff;
    font-size: .73rem;
    font-weight: 500;
    color: var(--text-body);
    white-space: nowrap;
}
.tag { display: inline-block; padding: .1rem .5rem; border-radius: 5px; background: var(--primary-soft); color: var(--primary); font-size: .72rem; font-weight: 600; margin: 0 .2rem .2rem 0; }

.status {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .18rem .6rem;
    border-radius: 999px;
    font-size: .73rem;
    font-weight: 600;
    white-space: nowrap;
    background: #f1f5f9;
    color: #475569;
}
.status::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-vigente, .status-aceita, .status-liquidada, .status-concluida, .status-ganha, .status-ativo, .status-cliente_ativo, .status-realizada, .status-em_dia, .status-saudavel, .status-atendida, .status-convertida, .status-ativa { background: #e7f5ec; color: #1f7a3a; }
.status-enviada, .status-em_negociacao, .status-em_andamento, .status-aberta, .status-parcial, .status-pendente, .status-qualificada, .status-em_analise, .status-prospect, .status-aguardando_assinatura, .status-em_renovacao { background: var(--info-bg); color: var(--info-text); }
.status-rascunho, .status-em_revisao, .status-em_elaboracao, .status-a_fazer, .status-nao_iniciada, .status-lead, .status-sem_dados, .status-inativo, .status-cliente_inativo { background: #f1f5f9; color: #475569; }
.status-aguardando, .status-aguardando_retorno, .status-suspenso, .status-espera, .status-atencao, .status-ex_cliente { background: var(--warn-bg); color: var(--warn-text); }
.status-recusada, .status-expirada, .status-cancelada, .status-cancelado, .status-perdida, .status-vencido, .status-risco, .status-encerrado, .status-estornada, .status-sem_interesse, .status-indeferida, .status-descartado, .status-vencida { background: var(--err-bg); color: var(--err-text); }

.flag {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .18rem .6rem;
    border-radius: 999px;
    font-size: .73rem;
    font-weight: 600;
    white-space: nowrap;
    border: 1px solid transparent;
}
.flag-vermelho { background: #fdecec; color: #b42318; border-color: #f5c2c2; }
.flag-amarelo { background: #fff7e0; color: #8a5a00; border-color: #f3d48b; }
.flag-verde { background: #e9f6e6; color: #2f7a17; border-color: #bfe2b0; }
.flag-azul { background: #e8f1fb; color: #0b4f8a; border-color: #bcd5f0; }
.flag-cinza { background: #f1f5f9; color: #475569; border-color: #dbe2ea; }
.flag-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }
.flag-dot.vermelho { background: #d92d20; } .flag-dot.amarelo { background: #e0a100; } .flag-dot.verde { background: #5aa832; } .flag-dot.azul { background: #0b67b0; } .flag-dot.cinza { background: #94a3b8; }

.prio { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.prio-alta { color: var(--lorient-red); }
.prio-media { color: var(--lorient-amber); }
.prio-baixa { color: var(--text-muted); }

.alert {
    display: flex;
    align-items: flex-start;
    gap: .6rem;
    padding: .75rem .9rem;
    margin-bottom: 1rem;
    border-radius: var(--radius-sm);
    border: 1px solid;
    font-size: .86rem;
}
.alert i { margin-top: 2px; }
.alert-success { background: var(--ok-bg); border-color: var(--ok-border); color: var(--ok-text); }
.alert-error { background: var(--err-bg); border-color: var(--err-border); color: var(--err-text); }
.alert-warning { background: var(--warn-bg); border-color: var(--warn-border); color: var(--warn-text); }
.alert-info { background: var(--info-bg); border-color: var(--info-border); color: var(--info-text); }
.alert .alert-close { margin-left: auto; background: none; border: 0; color: inherit; cursor: pointer; opacity: .7; }
.flash-stack { padding-top: 1rem; }

.form-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: .9rem 1rem; }
.col-12 { grid-column: span 12; } .col-9 { grid-column: span 9; } .col-8 { grid-column: span 8; } .col-6 { grid-column: span 6; } .col-4 { grid-column: span 4; } .col-3 { grid-column: span 3; } .col-2 { grid-column: span 2; }
.field { min-width: 0; }
.field-label { display: block; margin-bottom: .35rem; font-size: .8rem; font-weight: 600; color: var(--text-dark); }
.field-label .req { color: var(--lorient-red); margin-left: 2px; }
.field-hint { font-size: .74rem; color: var(--text-muted); margin-top: .3rem; }
.field-error { font-size: .76rem; color: var(--err-text); margin-top: .3rem; font-weight: 500; }
.form-control {
    width: 100%;
    height: 38px;
    padding: 0 .8rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: #fff;
    color: var(--text-dark);
    font: inherit;
    font-size: .875rem;
    outline: none;
    transition: border-color .15s, box-shadow .15s;
}
textarea.form-control { height: auto; min-height: 90px; padding: .6rem .8rem; resize: vertical; line-height: 1.5; }
select.form-control { cursor: pointer; padding-right: 2rem; }
.form-control::placeholder { color: var(--text-faint); }
.form-control:hover { border-color: #cfd6df; }
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-ring); }
.form-control.is-invalid { border-color: var(--lorient-red); }
.form-control-sm { height: 32px; font-size: .8rem; }
.check { display: inline-flex; align-items: center; gap: .5rem; font-size: .86rem; cursor: pointer; user-select: none; }
.check input { width: 16px; height: 16px; accent-color: var(--primary); cursor: pointer; }
.form-section { font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--lorient-teal); grid-column: span 12; padding-top: .6rem; border-top: 1px solid var(--border-soft); margin-top: .3rem; }
.form-section:first-child { border-top: 0; padding-top: 0; margin-top: 0; }
.form-actions { display: flex; gap: .6rem; justify-content: flex-end; margin-top: 1.2rem; padding-top: 1rem; border-top: 1px solid var(--border-soft); flex-wrap: wrap; }
.input-group { display: flex; }
.input-group .addon { display: grid; place-items: center; padding: 0 .7rem; border: 1px solid var(--border-color); border-right: 0; border-radius: var(--radius-sm) 0 0 var(--radius-sm); background: var(--bg-subtle); color: var(--text-muted); font-size: .8rem; font-weight: 600; }
.input-group .form-control { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }

.filter-bar { background: #fff; border: 1px solid var(--border-color); border-radius: var(--radius); padding: .9rem 1rem; margin-bottom: 1rem; box-shadow: var(--shadow-sm); }
.filter-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: .7rem; align-items: end; }
.filter-grid .wide { grid-column: span 2; }
.filter-actions { display: flex; gap: .5rem; align-items: end; }
.quick-periods { display: flex; gap: .35rem; flex-wrap: wrap; margin-bottom: .7rem; }
.quick-periods a { font-size: .76rem; padding: .25rem .65rem; border-radius: 999px; border: 1px solid var(--border-color); color: var(--text-body); background: #fff; }
.quick-periods a:hover { border-color: var(--primary); color: var(--primary); text-decoration: none; }
.quick-periods a.active { background: var(--primary); border-color: var(--primary); color: #fff; }

.pagination { display: flex; justify-content: space-between; align-items: center; gap: .75rem; padding: .9rem 0 0; flex-wrap: wrap; font-size: .8rem; color: var(--text-muted); }
.pagination-links { display: flex; gap: .3rem; flex-wrap: wrap; }
.pagination-links a, .pagination-links span { min-width: 32px; height: 32px; display: grid; place-items: center; padding: 0 .5rem; border-radius: 6px; border: 1px solid var(--border-color); background: #fff; color: var(--text-body); font-weight: 600; }
.pagination-links a:hover { border-color: var(--primary); color: var(--primary); text-decoration: none; }
.pagination-links .current { background: var(--primary); border-color: var(--primary); color: #fff; }
.pagination-links .disabled { opacity: .45; }

.tabs { display: flex; gap: .2rem; border-bottom: 1px solid var(--border-color); margin-bottom: 1.1rem; overflow-x: auto; scrollbar-width: thin; }
.tabs a, .tabs button {
    padding: .7rem .95rem;
    font: inherit;
    font-size: .86rem;
    font-weight: 600;
    color: var(--text-muted);
    border: 0;
    background: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    cursor: pointer;
    white-space: nowrap;
}
.tabs a:hover, .tabs button:hover { color: var(--text-dark); text-decoration: none; }
.tabs .active { color: var(--primary); border-bottom-color: var(--primary); }
.tabs .count { font-size: .7rem; background: var(--bg-subtle); border: 1px solid var(--border-color); border-radius: 999px; padding: 0 .4rem; margin-left: .25rem; color: var(--text-muted); }

.dl { display: grid; grid-template-columns: 160px minmax(0, 1fr); gap: .5rem 1rem; font-size: .86rem; }
.dl dt { color: var(--text-muted); font-weight: 500; }
.dl dd { color: var(--text-dark); word-break: break-word; }

.timeline { list-style: none; position: relative; padding-left: 1.4rem; }
.timeline::before { content: ''; position: absolute; left: 6px; top: 4px; bottom: 4px; width: 2px; background: var(--border-color); }
.timeline li { position: relative; padding: 0 0 1.1rem; }
.timeline li::before { content: ''; position: absolute; left: -1.4rem; top: 4px; width: 14px; height: 14px; border-radius: 50%; background: #fff; border: 3px solid var(--lorient-teal); }
.timeline li.done::before { border-color: var(--lorient-green); background: var(--lorient-green); }
.timeline li.overdue::before { border-color: var(--lorient-red); }
.timeline .tl-head { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; font-size: .86rem; }
.timeline .tl-meta { font-size: .76rem; color: var(--text-muted); }
.timeline .tl-body { font-size: .84rem; color: var(--text-body); margin-top: .25rem; white-space: pre-line; }

.kanban { display: flex; gap: .85rem; overflow-x: auto; padding-bottom: 1rem; align-items: flex-start; scrollbar-width: thin; }
.kanban-col { flex: 0 0 280px; background: #eef2f6; border-radius: var(--radius); display: flex; flex-direction: column; max-height: calc(100vh - 230px); }
.kanban-col-head { padding: .75rem .85rem .6rem; border-top: 3px solid var(--col-color, var(--primary)); border-radius: var(--radius) var(--radius) 0 0; }
.kanban-col-head .name { font-weight: 700; font-size: .84rem; display: flex; justify-content: space-between; gap: .5rem; }
.kanban-col-head .meta { font-size: .73rem; color: var(--text-muted); margin-top: .15rem; }
.kanban-list { padding: .25rem .55rem .7rem; overflow-y: auto; flex: 1; min-height: 80px; display: flex; flex-direction: column; gap: .5rem; transition: background .15s; border-radius: 0 0 var(--radius) var(--radius); }
.kanban-list.drag-over { background: #dfe8f1; }
.kanban-card { background: #fff; border: 1px solid var(--border-color); border-radius: 9px; padding: .65rem .7rem; box-shadow: var(--shadow-sm); cursor: grab; font-size: .8rem; }
.kanban-card:focus { outline: 2px solid var(--primary); }
.kanban-card.dragging { opacity: .5; }
.kanban-card .kc-title { font-weight: 600; font-size: .84rem; color: var(--text-dark); display: block; }
.kanban-card .kc-sub { color: var(--text-muted); font-size: .76rem; margin-top: .15rem; }
.kanban-card .kc-foot { display: flex; justify-content: space-between; align-items: center; margin-top: .45rem; gap: .4rem; flex-wrap: wrap; }
.kanban-card .kc-value { font-weight: 700; color: var(--lorient-blue); }
.kanban-card .kc-move { display: none; }
.kanban-card.overdue { border-left: 3px solid var(--lorient-red); }

.calendar { width: 100%; border-collapse: collapse; table-layout: fixed; }
.calendar th { font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); padding: .5rem; text-align: left; border-bottom: 1px solid var(--border-color); }
.calendar td { border: 1px solid var(--border-soft); vertical-align: top; height: 112px; padding: .35rem; }
.calendar td.other { background: #fafbfc; }
.calendar td.other .day-num { color: var(--text-faint); }
.calendar td.today { background: #f3f8fd; }
.calendar .day-num { font-size: .76rem; font-weight: 700; color: var(--text-body); margin-bottom: .2rem; display: block; }
.calendar td.today .day-num { color: var(--primary); }
.cal-event { display: block; font-size: .72rem; padding: .12rem .35rem; border-radius: 4px; margin-bottom: .2rem; background: var(--primary-soft); color: var(--primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-left: 3px solid var(--primary); }
.cal-event:hover { text-decoration: none; filter: brightness(.96); }
.cal-event.reuniao, .cal-event.visita, .cal-event.demonstracao { background: #e7f5ec; color: #1f7a3a; border-left-color: var(--lorient-green); }
.cal-event.concluida { opacity: .55; text-decoration: line-through; }
.cal-event.vencida { background: var(--err-bg); color: var(--err-text); border-left-color: var(--lorient-red); }

.progress { height: 8px; background: var(--border-soft); border-radius: 999px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: linear-gradient(90deg, var(--lorient-lime), var(--lorient-teal)); border-radius: 999px; }

.score-meter { display: flex; align-items: center; gap: 1rem; }
.score-ring { --val: 0; --color: #94a3b8; width: 86px; height: 86px; border-radius: 50%; background: conic-gradient(var(--color) calc(var(--val) * 1%), var(--border-soft) 0); display: grid; place-items: center; flex: none; }
.score-ring span { width: 66px; height: 66px; border-radius: 50%; background: #fff; display: grid; place-items: center; font-weight: 800; font-size: 1.3rem; }
.factor-list { list-style: none; display: grid; gap: .45rem; font-size: .8rem; }
.factor-list li { display: grid; grid-template-columns: minmax(0, 1fr) 70px 46px; gap: .6rem; align-items: center; }
.factor-list .progress { height: 6px; }

.widget-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 1.1rem; }
.widget { grid-column: span 6; position: relative; }
.widget.w-12 { grid-column: span 12; } .widget.w-4 { grid-column: span 4; } .widget.w-8 { grid-column: span 8; }
.widget .widget-handle { cursor: grab; color: var(--text-faint); background: none; border: 0; padding: .2rem; display: none; }
.customizing .widget { outline: 2px dashed var(--border-color); outline-offset: 4px; }
.customizing .widget-handle { display: inline-block; }
.widget.dragging { opacity: .5; }
.chart-box { position: relative; height: 260px; }
.chart-box.sm { height: 200px; }

.notif-item { display: flex; gap: .75rem; padding: .8rem 0; border-bottom: 1px solid var(--border-soft); }
.notif-item:last-child { border-bottom: 0; }
.notif-item.unread .notif-title { font-weight: 700; }
.notif-icon { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); flex: none; }
.notif-icon.alta { background: var(--err-bg); color: var(--err-text); }
.notif-icon.media { background: var(--warn-bg); color: var(--warn-text); }

.list-plain { list-style: none; }
.list-plain li { padding: .55rem 0; border-bottom: 1px solid var(--border-soft); display: flex; justify-content: space-between; gap: .75rem; align-items: center; font-size: .85rem; }
.list-plain li:last-child { border-bottom: 0; }

.search-group { margin-bottom: 1.3rem; }
.search-group h3 { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--lorient-teal); margin-bottom: .5rem; }

.items-table input.form-control, .items-table select.form-control { height: 34px; font-size: .82rem; }
.items-table td { padding: .4rem .35rem; }
.totals-box { margin-left: auto; width: min(360px, 100%); font-size: .88rem; }
.totals-box div { display: flex; justify-content: space-between; padding: .3rem 0; }
.totals-box .grand { font-size: 1.05rem; font-weight: 800; border-top: 2px solid var(--border-color); padding-top: .55rem; margin-top: .3rem; }

.perm-matrix th, .perm-matrix td { text-align: center; }
.perm-matrix td:first-child, .perm-matrix th:first-child { text-align: left; }

.modal-backdrop { position: fixed; inset: 0; background: rgba(15, 23, 42, .45); display: none; align-items: center; justify-content: center; z-index: 200; padding: 1rem; }
.modal-backdrop.open { display: flex; }
.modal { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow-lg); width: min(520px, 100%); max-height: calc(100vh - 2rem); overflow-y: auto; }
.modal-head { padding: 1rem 1.2rem; border-bottom: 1px solid var(--border-soft); display: flex; justify-content: space-between; align-items: center; }
.modal-head h2 { font-size: 1rem; }
.modal-body { padding: 1.1rem 1.2rem; }
.modal-foot { padding: .9rem 1.2rem; border-top: 1px solid var(--border-soft); display: flex; justify-content: flex-end; gap: .5rem; }

.report-meta { display: flex; gap: 1.2rem; flex-wrap: wrap; font-size: .8rem; color: var(--text-muted); margin-bottom: 1rem; }
.report-meta strong { color: var(--text-dark); font-weight: 600; }
.report-notes { font-size: .8rem; color: var(--text-muted); background: var(--bg-subtle); border: 1px solid var(--border-soft); border-radius: var(--radius-sm); padding: .75rem .9rem; }
.report-notes ul { padding-left: 1.1rem; display: grid; gap: .2rem; }
.report-section + .report-section { margin-top: 1.4rem; }
.report-section h3 { font-size: .95rem; margin-bottom: .6rem; }
.report-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .9rem; }
.report-card { display: flex; gap: .85rem; align-items: flex-start; background: #fff; border: 1px solid var(--border-color); border-radius: var(--radius); padding: 1rem; color: inherit; transition: box-shadow .15s, border-color .15s; }
.report-card:hover { box-shadow: var(--shadow-md); border-color: #cfd6df; text-decoration: none; }
.report-card .rc-icon { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); flex: none; }
.report-card .rc-icon.green { background: #e9f6e6; color: #2f7a17; }
.report-card .rc-icon.teal { background: #e3f5f2; color: #0c7a6b; }
.report-card .rc-icon.red { background: var(--err-bg); color: var(--err-text); }
.report-card strong { display: block; font-size: .9rem; color: var(--text-dark); }
.report-card span { font-size: .78rem; color: var(--text-muted); }

.auth { display: grid; grid-template-columns: 1fr 1fr; min-height: 100vh; background: #fff; }
.auth-aside { position: relative; overflow: hidden; display: flex; flex-direction: column; padding: 48px 48px 40px; background: linear-gradient(135deg, #f1f8f0 0%, #eaf5f3 45%, #e9f1fa 100%); border-right: 1px solid #e6ecf1; }
.auth-aside .circuit { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.aside-brand, .aside-body, .aside-note { position: relative; z-index: 1; }
.aside-brand { display: flex; align-items: center; gap: 12px; font-weight: 700; font-size: 20px; }
.aside-brand img { width: 52px; height: 52px; }
.aside-body { margin: auto 0; padding: 56px 0 40px; max-width: 420px; }
.aside-body h2 { font-size: 29px; line-height: 1.2; font-weight: 700; letter-spacing: -.02em; }
.aside-body p { margin-top: 14px; font-size: 15px; line-height: 1.55; color: #4b5563; }
.features { list-style: none; margin-top: 30px; display: flex; flex-direction: column; gap: 12px; }
.features li { display: flex; align-items: center; gap: 14px; font-size: 14.5px; font-weight: 500; }
.feature-icon { flex: none; width: 36px; height: 36px; display: grid; place-items: center; background: #fff; border: 1px solid #e3e9ee; border-radius: 9px; box-shadow: var(--shadow-sm); }
.fi-green { color: #6cb33f; } .fi-blue { color: var(--primary); } .fi-teal { color: var(--lorient-teal); }
.aside-note { font-size: 12.5px; color: var(--text-muted); }
.auth-main { display: flex; align-items: center; justify-content: center; padding: 48px 24px; }
.auth-form { width: 100%; max-width: 400px; }
.auth-form .logo { width: 46px; height: 46px; display: block; }
.auth-form h1 { margin: 26px 0 6px; font-size: 23px; font-weight: 700; }
.auth-form .lead { margin-bottom: 22px; font-size: 14px; color: #4b5563; }
.auth .input { width: 100%; height: 42px; padding: 0 14px; border: 1px solid #dfe5ec; border-radius: 8px; background: #e8f0fe; color: var(--text-dark); font: inherit; font-size: 14.5px; outline: none; transition: border-color .15s, box-shadow .15s, background .15s; }
.auth .input.has-icon { padding-left: 38px; }
.auth .input.has-toggle { padding-right: 44px; }
.auth .input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-ring); background: #fff; }
.auth .field { margin-bottom: 18px; }
.auth .field label { display: block; margin-bottom: 8px; font-size: 13.5px; font-weight: 600; }
.input-wrap { position: relative; }
.input-wrap .icon-left { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--text-muted); pointer-events: none; }
.toggle-pass { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 32px; height: 32px; display: grid; place-items: center; border: 0; background: transparent; border-radius: 6px; color: var(--text-muted); cursor: pointer; }
.toggle-pass:hover { color: var(--text-dark); background: rgba(0, 0, 0, .04); }
.auth .btn-primary { width: 100%; height: 44px; font-size: 14.5px; }
.auth .help { margin-top: 18px; text-align: center; font-size: 13px; color: var(--text-muted); }

.error-page { max-width: 560px; margin: 4rem auto; text-align: center; }
.error-page .code { font-size: 3.4rem; font-weight: 800; background: linear-gradient(90deg, var(--lorient-lime), var(--lorient-teal), var(--lorient-blue)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.error-page pre { text-align: left; background: #0f172a; color: #e2e8f0; padding: 1rem; border-radius: var(--radius-sm); overflow-x: auto; font-size: .75rem; margin-top: 1rem; }

.sidebar-backdrop { display: none; }

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

@media (max-width: 1100px) {
    .widget, .widget.w-4, .widget.w-8 { grid-column: span 12; }
    .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 960px) {
    .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
    body.sidebar-open .sidebar { transform: translateX(0); }
    body.sidebar-open .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(15, 23, 42, .35); z-index: 55; }
    .main-area { margin-left: 0; }
    .menu-toggle { display: grid; place-items: center; }
    .user-text, .global-search kbd { display: none; }
    .auth { grid-template-columns: 1fr; }
    .auth-aside { display: none; }
}

@media (max-width: 720px) {
    .content { padding: 0 1rem 2rem; }
    .topbar-inner { padding: 0 1rem; gap: .5rem; }
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
    .form-grid > [class*="col-"] { grid-column: span 12; }
    .page-head h1 { font-size: 1.35rem; }
    .dl { grid-template-columns: 1fr; gap: .1rem; }
    .dl dd { margin-bottom: .5rem; }
    .filter-grid .wide { grid-column: span 1; }
    .kanban-col { flex-basis: 85vw; }
    .kanban-card .kc-move { display: block; margin-top: .45rem; }
    .calendar td { height: 70px; padding: .2rem; }
    .cal-event { font-size: .62rem; }
    .table-responsive-cards thead { display: none; }
    .table-responsive-cards tr { display: block; border-bottom: 1px solid var(--border-color); padding: .5rem 0; }
    .table-responsive-cards td { display: flex; justify-content: space-between; gap: 1rem; border: 0; padding: .3rem .4rem; text-align: right; }
    .table-responsive-cards td::before { content: attr(data-label); font-weight: 600; color: var(--text-muted); font-size: .76rem; text-align: left; }
    .table-responsive-cards td.actions { justify-content: flex-end; }
    .table-responsive-cards td.actions::before { content: none; }
    .factor-list li { grid-template-columns: minmax(0, 1fr) 46px; }
    .factor-list li .progress { display: none; }
}

@media print {
    .sidebar, .topbar, .app-footer, .no-print, .page-actions, .filter-bar, .pagination, .tabs { display: none !important; }
    .main-area { margin: 0; }
    body { background: #fff; }
    .card { box-shadow: none; border: 0; padding: 0; }
}
.link-muted { font-size: .8rem; color: var(--text-muted); font-weight: 500; }
.link-muted:hover { color: var(--text-dark); }
.kanban-card:focus-within .kc-move { display: block; margin-top: .45rem; }
.inline-form{display:inline-block;margin:0}
.perm-presets{display:flex;flex-wrap:wrap;gap:.5rem;margin-bottom:1rem}
.perm-group-row td{background:var(--bg-subtle);font-weight:700;color:var(--text-muted);text-transform:uppercase;font-size:.75rem;letter-spacing:.04em}
.perm-matrix td.perm-row-toggle,.perm-matrix th.perm-row-toggle{width:1%;white-space:nowrap}
.perm-summary{list-style:none;margin:0;padding:0;font-size:.8rem;color:var(--text-muted)}
.perm-summary li{margin:.1rem 0}
.perm-summary strong{color:var(--text-dark);font-weight:600}
.profile-preview{border:1px dashed var(--border-color);border-radius:10px;padding:.75rem 1rem;background:var(--bg-subtle)}
.online-dot{display:inline-block;width:.55rem;height:.55rem;border-radius:50%;background:var(--lorient-green);margin-right:.35rem;vertical-align:middle}
.audit-fields{display:grid;grid-template-columns:minmax(110px,auto) 1fr;gap:.15rem .75rem;margin-top:.35rem}
.audit-fields .old{color:#b42318;text-decoration:line-through;word-break:break-word}
.audit-fields .new{color:#0f7a3d;word-break:break-word}
