/* Design system autoral do Brian (pos-INSPINIA) — ver docs/DESIGN_SYSTEM.md.
   Carregado só nas telas ja migradas (ver View/Layouts/design_system.ctp).
   Nao misturar com classes INSPINIA (.ibox/.widget/label-*) numa mesma tela. */

:root {
    --bg: #FBF5EF;
    --surface: #FFFFFF;
    --surface-alt: #FFF3E7;
    --ink: #2A2019;
    --ink-muted: #8A7A6C;
    --border: #ECDFD1;
    --accent: #E2611A;
    --accent-strong: #B8450F;
    --accent-soft: #F3A15C;
    --accent-pale: #FDE8D2;
    --danger: #ed5565;
    --sidebar-bg: #241B14;
    --sidebar-muted: #B8A99A;
    --sidebar-hover: rgba(226, 97, 26, 0.14);
}

body.ds {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: 'Sora', 'Helvetica Neue', Arial, sans-serif;
    font-size: 14px;
}

.ds a { color: var(--accent); }

/* ---- shell ---- */
.ds-shell { display: flex; min-height: 100vh; }

.ds-sidebar {
    flex: 0 0 240px;
    width: 240px;
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    padding: 28px 0;
}
.ds-sidebar-brand { padding: 0 24px 24px 24px; display: flex; align-items: center; gap: 10px; }
.ds-sidebar-mark { font-family: 'Bricolage Grotesque', sans-serif; font-weight: 800; font-size: 26px; color: var(--accent); line-height: 1; }
.ds-sidebar-name { color: #F2E9E0; font-weight: 600; font-size: 15px; letter-spacing: .02em; }
.ds-sidebar-profile { padding: 0 24px 20px 24px; border-bottom: 1px solid rgba(255,255,255,.08); margin-bottom: 16px; }
.ds-sidebar-profile strong { display: block; color: #F2E9E0; font-weight: 600; font-size: 13px; }
.ds-sidebar-profile span { color: var(--sidebar-muted); font-size: 11px; }

.ds-nav { display: flex; flex-direction: column; }
.ds-nav-link {
    display: flex; align-items: center; gap: 12px;
    padding: 13px 24px; color: var(--sidebar-muted);
    border-left: 3px solid transparent; text-decoration: none;
    font-size: 13px; transition: background .15s ease, color .15s ease;
}
.ds-nav-link:hover { background: var(--sidebar-hover); color: #fff; text-decoration: none; }
.ds-nav-link.active { color: #fff; background: rgba(226,97,26,.16); border-left-color: var(--accent); }
.ds-nav-badge { margin-left: auto; background: var(--accent); color: #fff; font-size: 10px; font-weight: 700; padding: 2px 6px; border-radius: 9px; }

.ds-sidebar-footer { margin-top: auto; padding: 20px 24px 0 24px; border-top: 1px solid rgba(255,255,255,.08); }
.ds-sidebar-footer a { display: flex; align-items: center; gap: 8px; color: var(--sidebar-muted); font-size: 12px; text-decoration: none; }
.ds-sidebar-footer a:hover { color: #fff; }

.ds-main { flex: 1; display: flex; flex-direction: column; }

.ds-topbar { height: 56px; flex: 0 0 56px; display: flex; align-items: center; justify-content: flex-end; padding: 0 40px; gap: 22px; }
.ds-topbar-bell { position: relative; color: var(--ink-muted); }
.ds-topbar-badge { position: absolute; top: -7px; right: -9px; background: var(--accent); color: #fff; font-size: 9px; font-weight: 700; padding: 1px 5px; border-radius: 8px; }
.ds-topbar-dropdown { position: absolute; right: 0; top: 28px; background: var(--surface); border: 1px solid var(--border); border-radius: 6px; min-width: 260px; box-shadow: 0 8px 24px rgba(42,32,25,.12); padding: 6px 0; z-index: 20; }
.ds-topbar-dropdown a { display: block; padding: 9px 16px; font-size: 12px; color: var(--ink); text-decoration: none; }
.ds-topbar-dropdown a:hover { background: var(--accent-pale); }

.ds-header { padding: 8px 40px 28px 40px; }
.ds-header-eyebrow { font-size: 11px; font-weight: 600; letter-spacing: .14em; color: var(--accent); text-transform: uppercase; margin-bottom: 10px; }
.ds-header h1 { margin: 0 0 8px 0; font-family: 'Bricolage Grotesque', sans-serif; font-weight: 700; font-size: 40px; letter-spacing: -0.01em; color: var(--ink); }
.ds-header-sub { font-size: 14px; color: var(--ink-muted); max-width: 560px; }

.ds-content { padding: 0 40px 40px 40px; display: flex; flex-direction: column; gap: 28px; }
.ds-footer { padding: 18px 40px; border-top: 1px solid var(--border); font-size: 12px; color: var(--ink-muted); }

/* ---- section divider (01/02/03 — ver DESIGN_SYSTEM.md §5) ---- */
.ds-section-divider { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.ds-section-num { font-family: 'Bricolage Grotesque', sans-serif; font-weight: 700; font-size: 13px; color: var(--accent); }
.ds-section-rule { flex: 1; height: 1px; background: var(--border); }
.ds-section-label { font-size: 11px; font-weight: 600; letter-spacing: .12em; color: var(--ink-muted); text-transform: uppercase; }

/* ---- cards ---- */
.ds-card { background: var(--surface); border: 1px solid var(--border); border-radius: 6px; }
.ds-card--alt { background: var(--surface-alt); border-radius: 6px; border: none; }
.ds-card-pad { padding: 20px 24px; }
.ds-card-pad-sm { padding: 20px; }

/* ---- KPI grid (hero + secundarios — ver DESIGN_SYSTEM.md §4) ---- */
.ds-kpi-grid { display: grid; grid-template-columns: 1.7fr 1fr 1fr 1fr; gap: 16px; }
.ds-kpi-grid--3 { grid-template-columns: 1.7fr 1fr 1fr; }
.ds-kpi-grid--5 { grid-template-columns: 1.4fr 1fr 1fr 1fr 1fr; }
.ds-kpi-hero { display: flex; flex-direction: column; justify-content: space-between; }
.ds-kpi-hero-top { display: flex; align-items: center; justify-content: space-between; }
.ds-kpi-hero-num { font-family: 'Bricolage Grotesque', sans-serif; font-weight: 700; font-size: 56px; line-height: 1; color: var(--ink); margin-top: 22px; }
.ds-kpi-hero-label { font-size: 13px; color: var(--ink-muted); margin-top: 8px; }
.ds-kpi { display: flex; flex-direction: column; gap: 14px; padding: 20px; }
.ds-kpi-num { font-family: 'Bricolage Grotesque', sans-serif; font-weight: 700; font-size: 28px; color: var(--ink); }
.ds-kpi-label { font-size: 12px; color: var(--ink-muted); margin-top: 4px; }

.ds-icon-badge { width: 38px; height: 38px; border-radius: 50%; background: var(--accent-pale); display: flex; align-items: center; justify-content: center; color: var(--accent-strong); }
.ds-icon-badge--sm { width: 34px; height: 34px; }
.ds-chip { background: var(--accent-pale); color: var(--accent-strong); font-size: 11px; font-weight: 600; padding: 4px 9px; border-radius: 20px; }

/* ---- linha 2: prática + filtro ---- */
.ds-row-2 { display: grid; grid-template-columns: 1fr 2fr; gap: 16px; }
.ds-highlight-num { font-family: 'Bricolage Grotesque', sans-serif; font-weight: 700; font-size: 40px; color: var(--accent-strong); line-height: 1; }
.ds-highlight-label { font-size: 15px; font-weight: 600; color: var(--ink); margin-top: 6px; }
.ds-highlight-sub { font-size: 12px; color: var(--ink-muted); margin-top: 4px; }
.ds-highlight-foot { margin-top: 18px; padding-top: 14px; border-top: 1px solid rgba(184,69,15,.15); font-size: 12px; color: var(--ink-muted); }

.ds-filter-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.ds-filter-title { margin: 0; font-size: 13px; font-weight: 600; color: var(--ink); text-transform: uppercase; letter-spacing: .06em; }
.ds-pill-group { display: inline-flex; background: var(--bg); border: 1px solid var(--border); border-radius: 20px; padding: 3px; }
.ds-pill { padding: 6px 14px; font-size: 12px; border-radius: 16px; color: var(--ink-muted); cursor: pointer; border: 0; background: none; font-family: inherit; }
.ds-pill.active { background: var(--accent); color: #fff; font-weight: 600; }
.ds-stat-row { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 10px; text-align: center; }
.ds-stat-num { font-family: 'Bricolage Grotesque', sans-serif; font-weight: 700; font-size: 22px; color: var(--ink); }
.ds-stat-label { font-size: 11px; color: var(--ink-muted); margin-top: 2px; }

/* ---- graficos ---- */
.ds-chart-row { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; }
.ds-chart-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 18px; }
.ds-chart-title { margin: 0; font-size: 13px; font-weight: 600; color: var(--ink); text-transform: uppercase; letter-spacing: .06em; }
.ds-chart-sub { font-size: 11px; color: var(--ink-muted); }
.ds-donut-card { display: flex; flex-direction: column; align-items: center; }
.ds-donut-wrap { position: relative; width: 150px; height: 150px; }
.ds-donut-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ds-donut-num { font-family: 'Bricolage Grotesque', sans-serif; font-weight: 700; font-size: 22px; color: var(--ink); }
.ds-donut-legend { display: flex; gap: 18px; font-size: 12px; margin-top: 18px; }
.ds-donut-legend .dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; margin-right: 6px; }

/* ---- tabela + alertas ---- */
.ds-split-row { display: grid; grid-template-columns: 7fr 5fr; gap: 16px; }
.ds-panel-head { padding: 18px 22px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--border); }
.ds-panel-title { margin: 0; font-size: 13px; font-weight: 600; color: var(--ink); text-transform: uppercase; letter-spacing: .06em; }
.ds-panel-link { font-size: 12px; font-weight: 600; color: var(--accent-strong); display: flex; align-items: center; gap: 4px; text-decoration: none; }

.ds-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.ds-table th { text-align: left; padding: 10px 22px; font-size: 11px; font-weight: 600; letter-spacing: .04em; color: var(--ink-muted); text-transform: uppercase; }
.ds-table td { padding: 11px 22px; border-top: 1px solid var(--border); }
.ds-table tbody tr:hover { background: #FBF0E4; }
.ds-table-name { display: flex; align-items: center; gap: 10px; }
.ds-name-link { display: inline-flex; align-items: center; gap: 8px; color: var(--ink); text-decoration: none; }
.ds-name-link:hover { color: var(--accent-strong); text-decoration: underline; }
.ds-name-link svg { flex: 0 0 auto; }
.ds-avatar { width: 26px; height: 26px; border-radius: 50%; background: var(--accent-pale); color: var(--accent-strong); font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex: 0 0 auto; }

.ds-badge { display: inline-block; font-size: 10px; font-weight: 600; padding: 3px 8px; border-radius: 12px; }
.ds-badge-muito-ativo { background: var(--accent); color: #fff; }
.ds-badge-ativo-moderado { background: var(--accent-pale); color: var(--accent-strong); }
.ds-badge-inativo { background: var(--accent-soft); color: #fff; }
.ds-badge-em-risco { background: var(--danger); color: #fff; }
.ds-badge-nunca-ativou { background: var(--border); color: var(--ink-muted); }

.ds-alert-row { display: flex; align-items: center; gap: 14px; padding: 14px 22px; border-bottom: 1px solid var(--border); }
.ds-alert-row:last-child { border-bottom: 0; }
.ds-alert-row:hover { background: #FBF0E4; }
.ds-alert-num { font-family: 'Bricolage Grotesque', sans-serif; font-weight: 700; font-size: 16px; width: 26px; flex: 0 0 auto; }
.ds-panel-foot { padding: 16px 22px; border-top: 1px solid var(--border); }
.ds-btn-outline { display: block; text-align: center; padding: 9px; font-size: 12px; font-weight: 600; color: var(--accent-strong); border: 1px solid var(--accent-soft); border-radius: 20px; text-decoration: none; }
.ds-btn-outline:hover { background: var(--accent-pale); text-decoration: none; }

.ds-empty { padding: 32px 22px; text-align: center; color: var(--ink-muted); font-size: 13px; }

/* ---- formularios (filtros) ---- */
.ds-form-row { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 16px; }
.ds-field label { display: block; font-size: 12px; font-weight: 600; color: var(--ink-muted); margin-bottom: 6px; }
.ds-select, .ds-input {
    width: 100%; padding: 9px 12px; font-size: 13px; font-family: inherit; color: var(--ink);
    background: var(--surface); border: 1px solid var(--border); border-radius: 6px;
}
.ds-select:focus, .ds-input:focus { outline: none; border-color: var(--accent); }
.ds-input-group { display: flex; gap: 8px; }
.ds-btn-icon {
    flex: 0 0 auto; width: 38px; height: 38px; border-radius: 6px; border: 1px solid var(--border);
    background: var(--surface); color: var(--ink-muted); display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.ds-btn-icon:hover { background: var(--accent-pale); color: var(--accent-strong); }

/* ---- tabs de segmento ---- */
.ds-tabs { display: flex; gap: 8px; flex-wrap: wrap; padding-bottom: 16px; margin-bottom: 16px; border-bottom: 1px solid var(--border); }
.ds-tab {
    display: flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 20px;
    font-size: 12px; font-weight: 600; color: var(--ink-muted); background: var(--bg);
    border: 1px solid var(--border); cursor: pointer; text-decoration: none;
}
.ds-tab:hover { color: var(--ink); text-decoration: none; }
.ds-tab.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.ds-tab .count { font-size: 11px; opacity: .85; }

/* ---- ação/link em linha de tabela ---- */
.ds-table-icon { margin-right: 6px; vertical-align: -3px; color: var(--accent); }
.ds-chip-list { display: flex; flex-wrap: wrap; gap: 4px; }
.ds-chip-tag { display: inline-block; font-size: 10px; padding: 2px 7px; border-radius: 10px; background: var(--border); color: var(--ink-muted); }
.ds-chip-tag--warn { background: var(--accent-pale); color: var(--accent-strong); }
.ds-row-action { display: inline-flex; width: 28px; height: 28px; align-items: center; justify-content: center; border-radius: 6px; border: 1px solid var(--border); color: var(--ink-muted); text-decoration: none; }
.ds-row-action:hover { background: var(--accent-pale); color: var(--accent-strong); text-decoration: none; }

/* ---- DataTables reskin (mantém a lib, só recolore — ver DESIGN_SYSTEM.md) ---- */
.ds .dataTables_wrapper { font-size: 13px; color: var(--ink); }
.ds .dataTables_wrapper .dataTables_filter input,
.ds .dataTables_wrapper .dataTables_length select {
    border: 1px solid var(--border); border-radius: 6px; padding: 5px 10px; font-family: inherit;
}
.ds .dataTables_wrapper .dataTables_filter input:focus,
.ds .dataTables_wrapper .dataTables_length select:focus { outline: none; border-color: var(--accent); }
.ds .dataTables_wrapper .dataTables_info,
.ds .dataTables_wrapper .dataTables_length,
.ds .dataTables_wrapper .dataTables_filter { color: var(--ink-muted); font-size: 12px; }
/* Este bundle do DataTables inclui a integração Bootstrap: a paginação
   renderiza como <ul class="pagination"><li class="paginate_button"><a>
   — "paginate_button" fica no <li>, quem carrega a cor de verdade (herdada
   do Bootstrap, #337ab7 azul) é o <a> dentro. Por isso as regras miram
   ".paginate_button a", não só ".paginate_button". */
.ds .dataTables_wrapper .dataTables_paginate,
.ds .dataTables_wrapper .pagination {
    margin: 0;
}
.ds .dataTables_wrapper .pagination > li > a,
.ds .dataTables_wrapper .pagination > li > span {
    border-radius: 6px !important; padding: 4px 10px !important; margin-left: 2px !important;
    color: var(--ink) !important; border: 1px solid transparent !important; background: transparent !important;
}
.ds .dataTables_wrapper .pagination > li.active > a,
.ds .dataTables_wrapper .pagination > li.active > span,
.ds .dataTables_wrapper .pagination > .paginate_button.current > a {
    background: var(--accent) !important; border-color: var(--accent) !important; color: #fff !important;
}
.ds .dataTables_wrapper .pagination > li > a:hover,
.ds .dataTables_wrapper .pagination > li > span:hover {
    background: var(--accent-pale) !important; border-color: var(--accent-pale) !important; color: var(--accent-strong) !important;
}
.ds .dataTables_wrapper .pagination > li.disabled > a,
.ds .dataTables_wrapper .pagination > li.disabled > span,
.ds .dataTables_wrapper .pagination > .paginate_button.disabled > a {
    color: var(--border) !important; background: transparent !important;
}
.ds .dataTables_wrapper .dataTables_processing { color: var(--ink-muted); }
.ds table.dataTable thead th { border-bottom: 1px solid #ddd; }
.ds table.dataTable.table-bordered { border: 1px solid var(--border); }
.ds table.dataTable.table-bordered th, .ds table.dataTable.table-bordered td { border: 1px solid var(--border); }
.ds table.dataTable.table-hover tbody tr:hover { background: #FBF0E4; }

/* ---- botoes ---- */
.ds-btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: 20px; font-size: 12px; font-weight: 600; border: 1px solid transparent; cursor: pointer; text-decoration: none; font-family: inherit; background: none; }
.ds-btn--sm { padding: 5px 12px; font-size: 11px; }
.ds-btn--primary { background: var(--accent); color: #fff; }
.ds-btn--primary:hover { background: var(--accent-strong); color: #fff; text-decoration: none; }
.ds-btn--white { background: var(--surface); border-color: var(--border); color: var(--ink); }
.ds-btn--white:hover { background: var(--accent-pale); text-decoration: none; color: var(--ink); }
.ds-btn--warning { background: var(--accent-soft); color: #fff; }
.ds-btn--warning:hover { background: var(--accent-strong); color: #fff; text-decoration: none; }
.ds-btn.disabled, .ds-btn[disabled] { opacity: .5; cursor: not-allowed; pointer-events: none; }
.ds-btn-group { display: inline-flex; border: 1px solid var(--border); border-radius: 20px; padding: 3px; gap: 2px; }
.ds-btn-group .ds-pill { border-radius: 16px; }

/* ---- barras de progresso ---- */
.ds-progress { height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; }
.ds-progress--mini { height: 4px; }
.ds-progress-bar { height: 100%; background: var(--accent); border-radius: 3px; }
.ds-progress-bar--soft { background: var(--accent-soft); }
.ds-progress-bar--strong { background: var(--accent-strong); }
.ds-progress-bar--danger { background: var(--danger); }

/* ---- avisos / notices ---- */
.ds-notice { padding: 14px 16px; border-radius: 6px; font-size: 13px; }
.ds-notice strong { display: block; margin-bottom: 2px; }
.ds-notice--warning { background: var(--accent-pale); color: var(--accent-strong); }
.ds-notice--neutral { background: var(--bg); border: 1px solid var(--border); color: var(--ink); }
.ds-notice + .ds-notice { margin-top: 10px; }

/* ---- listas simples ---- */
.ds-list { list-style: none; margin: 0; padding: 0; }
.ds-list-item { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.ds-list-item:last-child { border-bottom: 0; }
.ds-list--panel .ds-list-item { padding: 12px 22px; }
.ds-badge-rank { width: 22px; height: 22px; border-radius: 50%; background: var(--accent-pale); color: var(--accent-strong); display: inline-flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; flex: 0 0 auto; }

/* ---- card com destaque no topo (equivalente ao border-left do ibox) ---- */
.ds-card--accent-top { border-top: 3px solid var(--accent-soft); }
.ds-card--accent-top.positive { border-top-color: var(--accent); }
.ds-card--accent-top.info { border-top-color: var(--accent-strong); }

.ds-row-line { display: flex; align-items: center; gap: 12px; }
.ds-row-line > * { min-width: 0; }

/* ---- modal (Bootstrap JS mantido só pelo comportamento — reskin leve) ---- */
.ds .modal-content { border-radius: 6px; border-color: var(--border); }
.ds .modal-header { border-bottom-color: var(--border); }
.ds .modal-footer { border-top-color: var(--border); }
.ds .close { color: var(--ink-muted); opacity: 1; text-shadow: none; }
.ds table.ds-table input[type="checkbox"] { width: 15px; height: 15px; }

/* ---- tela de login (View/Login/index.ctp, layout proprio 'login') ---- */
.ds-login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.ds-login-card { width: 100%; max-width: 360px; background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 40px 36px; text-align: center; }
.ds-login-mark { font-family: 'Bricolage Grotesque', sans-serif; font-weight: 800; font-size: 34px; color: var(--accent); line-height: 1; margin-bottom: 12px; }
.ds-login-card h3 { margin: 0 0 6px 0; font-family: 'Bricolage Grotesque', sans-serif; font-weight: 700; font-size: 20px; color: var(--ink); }
.ds-login-card p { margin: 0 0 24px 0; font-size: 13px; color: var(--ink-muted); }
.ds-login-card form { display: flex; flex-direction: column; gap: 12px; text-align: left; }
.ds-login-card .ds-input { width: 100%; padding: 11px 14px; }
.ds-login-card .ds-btn--primary { width: 100%; justify-content: center; padding: 11px 16px; font-size: 13px; margin-top: 4px; }
