/* ==========================================================================
   Sistema de Gestão de Contratos — componentes de conteúdo

   O design system (tipografia, paleta, Training Rail, shell e topbar) vem do
   Portal RH, em assets/css/portal/. Este arquivo cuida só do que é específico
   deste sistema: formulários, tabelas, filtros, paginação, badges, modais e
   as telas de contrato.

   O bloco abaixo é uma camada de COMPATIBILIDADE: mapeia os nomes de token
   usados nas ~97 telas para os tokens oficiais do Portal RH. Em código novo,
   prefira os nomes oficiais (--color-*).
   ========================================================================== */

:root {
    /* Escala de cinzas derivada dos tokens oficiais */
    --ink-900: var(--color-text);
    --ink-800: #1F2937;
    --ink-700: #374151;
    --ink-600: #4B5563;
    --ink-500: var(--color-muted);
    --ink-400: #9CA3AF;
    --ink-300: #D1D5DB;
    --ink-200: var(--color-border);
    --ink-100: #F0F2F5;
    --ink-050: var(--color-background);
    --white:   var(--color-surface);

    --brand-primary-fallback: #E20E17;

    --ok-700: #15803d;
    --ok-500: var(--color-success);
    --ok-100: #dcfce7;
    --warn-700: #92400e;
    --warn-500: var(--color-warning);
    --warn-100: #fef3c7;
    --danger-700: #b91c1c;
    --danger-500: var(--color-danger);
    --danger-100: #fee2e2;
    --info-700: #1B4E7A;
    --info-500: #2B6CB0;
    --info-100: #E6F0F9;

    --radius-sm:   8px;
    --radius:     12px;
    --radius-lg:  14px;
    --radius-pill: 999px;

    --shadow-sm: 0 1px 2px rgba(17, 24, 39, .06), 0 1px 3px rgba(17, 24, 39, .04);
    --shadow:    var(--shadow-md);
    --shadow-lg: 0 8px 24px rgba(17, 24, 39, .12);

    --font: var(--font-sans);

    --space-1:  4px;
    --space-2:  8px;
    --space-2h:10px;
    --space-3: 12px;
    --space-3h:14px;
    --space-4: 16px;
    --space-4h:20px;
    --space-5: 24px;
    --space-6: 32px;
    --space-7: 48px;
}

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

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

body {
    margin: 0;
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.55;
    color: var(--ink-800);
    background: var(--ink-050);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 { margin: 0 0 var(--space-3); font-weight: 600; line-height: 1.25; color: var(--ink-900); }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.1rem; }
h4 { font-size: 1rem; }
p  { margin: 0 0 var(--space-3); }

a { color: var(--brand-secondary); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; height: auto; }

hr { border: 0; border-top: 1px solid var(--ink-200); margin: var(--space-5) 0; }

code, kbd, pre { font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', monospace; font-size: .875em; }

/* Foco sempre visível — acessibilidade por teclado */
:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--brand-primary) 45%, white);
    outline-offset: 2px;
    border-radius: 4px;
}

.sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.skip-link {
    position: absolute; left: -9999px; top: 0; z-index: 999;
    background: var(--brand-primary); color: #fff; padding: 10px 18px;
    border-radius: 0 0 var(--radius) 0;
}
.skip-link:focus { left: 0; }

/* ==========================================================================
   Shell, Training Rail e topbar: assets/css/portal/training-rail.css
   ========================================================================== */

/* --- Topbar: conteúdo interno -------------------------------------------- *
   A caixa da topbar (altura 60, sticky, borda, vidro) vem do Portal RH.
   Aqui só o que este sistema coloca dentro dela.                            */

.topbar__toggle {
    display: none;                 /* só aparece no mobile, junto com a gaveta */
    width: 38px;
    height: 38px;
    flex: none;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    background: var(--color-surface);
    color: var(--color-text);
    cursor: pointer;
    padding: 0;
}

.topbar__heading {
    display: flex;
    flex-direction: column;
    justify-content: center;
    line-height: 1.2;
    min-width: 0;
}
.topbar__title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--color-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.topbar__context-value {
    font-size: .76rem;
    font-weight: 600;
    color: var(--color-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.topbar__search {
    position: relative;
    flex: 1 1 340px;
    max-width: 420px;
    margin-left: auto;
}
.topbar__search input {
    width: 100%;
    height: 38px;
    margin: 0;
    padding: 0 12px 0 38px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    background: var(--color-background);
    font: inherit;
    font-size: .88rem;
    color: var(--color-text);
}
.topbar__search input:focus {
    background: var(--color-surface);
    border-color: var(--color-primary);
    outline: none;
}
.topbar__search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--ink-400);
    pointer-events: none;
}

.topbar__actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
    flex: none;
}
.topbar__search + .topbar__actions { margin-left: 0; }

.icon-button {
    flex: none;
    position: relative; width: 40px; height: 40px; border-radius: var(--radius-sm);
    border: 1px solid var(--ink-200); background: #fff; cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center; color: var(--ink-700);
}
.icon-button:hover { background: var(--ink-050); }
.icon-button__count {
    position: absolute; top: -6px; right: -6px; min-width: 18px; height: 18px;
    padding: 0 4px; border-radius: 999px; background: var(--brand-primary);
    color: #fff; font-size: .68rem; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
}

.user-menu { position: relative; }
.user-menu__trigger {
    display: flex; align-items: center; gap: 10px; padding: 5px 10px 5px 5px;
    border: 1px solid var(--ink-200); border-radius: 999px; background: #fff; cursor: pointer;
    font-family: inherit;
}
.user-menu__trigger:hover { background: var(--ink-050); }
.avatar {
    width: 30px; height: 30px; border-radius: 50%; flex: 0 0 30px;
    background: var(--brand-primary); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: .78rem;
}
.user-menu__name { font-size: .86rem; font-weight: 600; color: var(--ink-800); max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.dropdown {
    position: absolute; right: 0; top: calc(100% + 8px); min-width: 230px;
    background: #fff; border: 1px solid var(--ink-200); border-radius: var(--radius);
    box-shadow: var(--shadow-lg); padding: 6px; z-index: 50;
}
.dropdown[hidden] { display: none; }
.dropdown__header { padding: 10px 12px; border-bottom: 1px solid var(--ink-100); margin-bottom: 4px; }
.dropdown__header strong { display: block; font-size: .88rem; }
.dropdown__header span { font-size: .76rem; color: var(--ink-500); word-break: break-all; }
.dropdown__item {
    display: flex; align-items: center; gap: 8px; width: 100%;
    padding: 9px 12px; border: 0; background: none; border-radius: var(--radius-sm);
    font-family: inherit; font-size: .88rem; color: var(--ink-800); cursor: pointer; text-align: left;
}
.dropdown__item:hover { background: var(--ink-050); text-decoration: none; }
.dropdown__item--danger { color: var(--danger-700); }


.page-header {
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: var(--space-4); flex-wrap: wrap; margin-bottom: var(--space-5);
}
.page-header__title { margin: 0; }
.page-header__subtitle { color: var(--ink-600); font-size: .92rem; margin: 4px 0 0; }
.page-header__actions { display: flex; gap: var(--space-2); flex-wrap: wrap; }

.breadcrumb { display: flex; gap: 6px; font-size: .8rem; color: var(--ink-500); margin-bottom: var(--space-2); flex-wrap: wrap; }
.breadcrumb a { color: var(--ink-600); }
.breadcrumb span[aria-current] { color: var(--ink-800); font-weight: 600; }

.footer {
    padding: var(--space-4) var(--space-5);
    border-top: 1px solid var(--ink-200);
    color: var(--ink-500); font-size: .8rem;
    display: flex; justify-content: space-between; gap: var(--space-3); flex-wrap: wrap;
}

/* ==========================================================================
   Componentes
   ========================================================================== */

/* --- Cartão -------------------------------------------------------------- */
.card {
    background: #fff; border: 1px solid var(--ink-200); border-radius: var(--radius);
    box-shadow: var(--shadow-sm); margin-bottom: var(--space-5);
}
.card__header {
    padding: var(--space-4) var(--space-5); border-bottom: 1px solid var(--ink-100);
    display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); flex-wrap: wrap;
}
.card__title { margin: 0; font-size: 1rem; font-weight: 600; }
.card__subtitle { margin: 2px 0 0; font-size: .82rem; color: var(--ink-500); font-weight: 400; }
.card__body { padding: var(--space-5); }
.card__body--flush { padding: 0; }
.card__footer { padding: var(--space-4) var(--space-5); border-top: 1px solid var(--ink-100); background: var(--ink-050); border-radius: 0 0 var(--radius) var(--radius); }

/* --- Botões -------------------------------------------------------------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    height: 40px; padding: 0 18px;
    border-radius: var(--radius-sm); border: 1px solid transparent;
    font-family: inherit; font-size: .89rem; font-weight: 600; line-height: 1;
    cursor: pointer; text-decoration: none; white-space: nowrap;
    transition: background-color .12s ease, border-color .12s ease, color .12s ease;
}
.btn:hover { text-decoration: none; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }

.btn--primary { background: var(--brand-primary); color: #fff; }
.btn--primary:hover { background: var(--brand-secondary); color: #fff; }

.btn--secondary { background: #fff; color: var(--ink-800); border-color: var(--ink-300); }
.btn--secondary:hover { background: var(--ink-050); }

.btn--ghost { background: transparent; color: var(--ink-700); }
.btn--ghost:hover { background: var(--ink-100); }

.btn--danger { background: var(--danger-500); color: #fff; }
.btn--danger:hover { background: var(--danger-700); color: #fff; }

.btn--success { background: var(--ok-500); color: #fff; }
.btn--success:hover { background: var(--ok-700); color: #fff; }

.btn--sm { height: 32px; padding: 0 12px; font-size: .81rem; }
.btn--lg { height: 46px; padding: 0 24px; font-size: .95rem; }
.btn--block { width: 100%; }
.btn--icon { width: 34px; height: 34px; padding: 0; }

.btn-group { display: inline-flex; gap: 6px; flex-wrap: wrap; }

/* --- Formulários --------------------------------------------------------- */
.form-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: var(--space-4); }
.col-1 { grid-column: span 1; }  .col-2 { grid-column: span 2; }
.col-3 { grid-column: span 3; }  .col-4 { grid-column: span 4; }
.col-5 { grid-column: span 5; }  .col-6 { grid-column: span 6; }
.col-7 { grid-column: span 7; }  .col-8 { grid-column: span 8; }
.col-9 { grid-column: span 9; }  .col-10 { grid-column: span 10; }
.col-11 { grid-column: span 11; } .col-12 { grid-column: span 12; }

.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field__label { font-size: .82rem; font-weight: 600; color: var(--ink-700); }
.field__label .required { color: var(--brand-primary); margin-left: 2px; }
.field__hint { font-size: .76rem; color: var(--ink-500); }
.field__error { font-size: .78rem; color: var(--danger-700); font-weight: 500; display: flex; gap: 5px; align-items: flex-start; }

.input, .select, .textarea {
    width: 100%; min-height: 40px; padding: 8px 12px;
    border: 1px solid var(--ink-300); border-radius: var(--radius-sm);
    font-family: inherit; font-size: .9rem; color: var(--ink-900); background: #fff;
}
.input:focus, .select:focus, .textarea:focus {
    border-color: var(--brand-primary); outline: none;
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-primary) 16%, transparent);
}
.input:disabled, .select:disabled, .textarea:disabled { background: var(--ink-100); color: var(--ink-500); cursor: not-allowed; }
.input[readonly] { background: var(--ink-050); }
.textarea { min-height: 92px; resize: vertical; line-height: 1.5; }
.select { appearance: none; background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%23565D6D' stroke-width='2'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 34px; }

.is-invalid { border-color: var(--danger-500) !important; }
.is-invalid:focus { box-shadow: 0 0 0 3px var(--danger-100) !important; }

.input-group { display: flex; }
.input-group .input { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.input-group .btn { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; border-color: var(--ink-300); }
.input-prefix {
    display: inline-flex; align-items: center; padding: 0 10px;
    background: var(--ink-100); border: 1px solid var(--ink-300); border-right: 0;
    border-radius: var(--radius-sm) 0 0 var(--radius-sm); font-size: .85rem; color: var(--ink-600);
}
.input-prefix + .input { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }

.checkbox, .radio { display: flex; align-items: flex-start; gap: 9px; font-size: .88rem; cursor: pointer; }
.checkbox input, .radio input { width: 17px; height: 17px; margin: 2px 0 0; accent-color: var(--brand-primary); flex: 0 0 17px; cursor: pointer; }
.checkbox span, .radio span { min-width: 0; }
.checkbox small, .radio small { display: block; color: var(--ink-500); font-size: .78rem; }

.checkbox-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: var(--space-3); }

.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch__track {
    width: 42px; height: 24px; border-radius: 999px; background: var(--ink-300);
    position: relative; transition: background-color .15s ease; flex: 0 0 42px;
}
.switch__track::after {
    content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px;
    border-radius: 50%; background: #fff; transition: transform .15s ease; box-shadow: var(--shadow-sm);
}
.switch input:checked + .switch__track { background: var(--ok-500); }
.switch input:checked + .switch__track::after { transform: translateX(18px); }
.switch input:focus-visible + .switch__track { outline: 3px solid color-mix(in srgb, var(--brand-primary) 45%, white); outline-offset: 2px; }

.fieldset { border: 1px solid var(--ink-200); border-radius: var(--radius); padding: var(--space-4); margin: 0 0 var(--space-4); }
.fieldset legend { padding: 0 8px; font-size: .82rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-600); }

.form-actions {
    display: flex; gap: var(--space-2); justify-content: flex-end; flex-wrap: wrap;
    padding-top: var(--space-4); margin-top: var(--space-4); border-top: 1px solid var(--ink-100);
}

/* --- Tabelas ------------------------------------------------------------- */
.table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.table th, .table td { padding: 11px var(--space-4); text-align: left; vertical-align: middle; }
.table thead th {
    background: var(--ink-050); border-bottom: 2px solid var(--ink-200);
    font-size: .74rem; text-transform: uppercase; letter-spacing: .05em;
    color: var(--ink-600); font-weight: 700; white-space: nowrap;
}
.table tbody tr { border-bottom: 1px solid var(--ink-100); }
.table tbody tr:last-child { border-bottom: 0; }
.table tbody tr:hover { background: var(--ink-050); }
.table td.numeric, .table th.numeric { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table td.actions { text-align: right; white-space: nowrap; }
.table__sort { color: var(--ink-600); display: inline-flex; align-items: center; gap: 4px; }
.table__sort:hover { color: var(--brand-primary); text-decoration: none; }
.table__sort[aria-sort] { color: var(--brand-secondary); font-weight: 700; }
.table--compact th, .table--compact td { padding: 7px var(--space-3); }
.table caption { caption-side: top; text-align: left; padding: 0 var(--space-4) var(--space-3); color: var(--ink-500); font-size: .8rem; }

/* --- Etiquetas ----------------------------------------------------------- */
.badge {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 2px 9px; border-radius: 999px;
    font-size: .74rem; font-weight: 700; line-height: 1.6;
    border: 1px solid transparent; white-space: nowrap;
}
.badge--neutral { background: var(--ink-100); color: var(--ink-700); border-color: var(--ink-200); }
.badge--success { background: var(--ok-100); color: var(--ok-700); border-color: color-mix(in srgb, var(--ok-500) 30%, white); }
.badge--warning { background: var(--warn-100); color: var(--warn-700); border-color: color-mix(in srgb, var(--warn-500) 30%, white); }
.badge--danger  { background: var(--danger-100); color: var(--danger-700); border-color: color-mix(in srgb, var(--danger-500) 30%, white); }
.badge--info    { background: var(--info-100); color: var(--info-700); border-color: color-mix(in srgb, var(--info-500) 30%, white); }
.badge--brand   { background: color-mix(in srgb, var(--brand-primary) 12%, white); color: var(--brand-secondary); border-color: color-mix(in srgb, var(--brand-primary) 30%, white); }

/* O ícone garante que a informação não dependa só da cor (acessibilidade) */
.badge__dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: 0 0 6px; }

.tag {
    display: inline-flex; align-items: center; padding: 1px 8px;
    background: var(--ink-100); border-radius: var(--radius-sm);
    font-size: .74rem; color: var(--ink-700); font-weight: 600;
}

/* --- Alertas / mensagens ------------------------------------------------- */
.alert {
    display: flex; gap: var(--space-3); align-items: flex-start;
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius); border: 1px solid; margin-bottom: var(--space-4);
    font-size: .89rem;
}
.alert__icon { flex: 0 0 20px; margin-top: 1px; }
.alert__content { flex: 1; min-width: 0; }
.alert__title { font-weight: 700; margin: 0 0 2px; }
.alert__close { background: none; border: 0; cursor: pointer; color: inherit; opacity: .6; padding: 0 2px; font-size: 1.1rem; line-height: 1; }
.alert__close:hover { opacity: 1; }

.alert--success { background: var(--ok-100); border-color: color-mix(in srgb, var(--ok-500) 35%, white); color: var(--ok-700); }
.alert--error   { background: var(--danger-100); border-color: color-mix(in srgb, var(--danger-500) 35%, white); color: var(--danger-700); }
.alert--warning { background: var(--warn-100); border-color: color-mix(in srgb, var(--warn-500) 35%, white); color: var(--warn-700); }
.alert--info    { background: var(--info-100); border-color: color-mix(in srgb, var(--info-500) 35%, white); color: var(--info-700); }

.flash-stack { position: fixed; top: 76px; right: 20px; z-index: 200; width: min(420px, calc(100vw - 40px)); }
.flash-stack .alert { box-shadow: var(--shadow-lg); }

/* --- Estado vazio -------------------------------------------------------- */
.empty-state { text-align: center; padding: var(--space-7) var(--space-5); color: var(--ink-600); }
.empty-state__icon { color: var(--ink-300); margin-bottom: var(--space-3); }
.empty-state__title { font-size: 1.05rem; font-weight: 600; color: var(--ink-800); margin-bottom: 6px; }
.empty-state__text { max-width: 460px; margin: 0 auto var(--space-4); font-size: .9rem; }

/* --- Indicadores (dashboard) --------------------------------------------- */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: var(--space-4); margin-bottom: var(--space-5); }

.kpi {
    display: block; background: #fff; border: 1px solid var(--ink-200);
    border-radius: var(--radius); padding: var(--space-4); box-shadow: var(--shadow-sm);
    color: inherit; text-decoration: none; position: relative; overflow: hidden;
}
a.kpi:hover { border-color: var(--brand-primary); box-shadow: var(--shadow); text-decoration: none; }
a.kpi:hover .kpi__link { opacity: 1; }
.kpi::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--ink-300); }
.kpi--brand::before   { background: var(--brand-primary); }
.kpi--success::before { background: var(--ok-500); }
.kpi--warning::before { background: var(--warn-500); }
.kpi--danger::before  { background: var(--danger-500); }
.kpi--info::before    { background: var(--info-500); }

.kpi__label { font-size: .78rem; color: var(--ink-600); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; margin-bottom: 6px; }
.kpi__value { font-size: 1.85rem; font-weight: 700; color: var(--ink-900); line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi__value--sm { font-size: 1.35rem; }
.kpi__meta { font-size: .78rem; color: var(--ink-500); margin-top: 5px; }
.kpi__link { position: absolute; right: 12px; top: 12px; opacity: .35; transition: opacity .12s ease; color: var(--brand-primary); }

/* --- Gráficos (SVG puro, sem biblioteca) --------------------------------- */
.chart { width: 100%; }
.chart-bar-row { display: grid; grid-template-columns: minmax(120px, 220px) 1fr auto; gap: var(--space-3); align-items: center; padding: 7px 0; font-size: .85rem; }
.chart-bar-row + .chart-bar-row { border-top: 1px solid var(--ink-100); }
.chart-bar-label { color: var(--ink-700); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chart-bar-track { background: var(--ink-100); border-radius: 999px; height: 12px; overflow: hidden; }
.chart-bar-fill { height: 100%; border-radius: 999px; background: var(--brand-primary); min-width: 2px; }
.chart-bar-value { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--ink-800); white-space: nowrap; }

/* --- Filtros ------------------------------------------------------------- */
.filters { background: #fff; border: 1px solid var(--ink-200); border-radius: var(--radius); margin-bottom: var(--space-4); }
.filters__body { padding: var(--space-4); display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: var(--space-3); align-items: end; }
.filters__actions { display: flex; gap: var(--space-2); padding: 0 var(--space-4) var(--space-4); flex-wrap: wrap; }
.filters__chips { display: flex; gap: 6px; flex-wrap: wrap; padding: 0 var(--space-4) var(--space-4); }
.filter-chip {
    display: inline-flex; align-items: center; gap: 6px; padding: 3px 6px 3px 10px;
    background: var(--ink-100); border-radius: 999px; font-size: .78rem; color: var(--ink-700);
}
.filter-chip a { color: var(--ink-500); font-weight: 700; line-height: 1; padding: 0 3px; }
.filter-chip a:hover { color: var(--danger-500); text-decoration: none; }

/* --- Paginação ----------------------------------------------------------- */
.pagination { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); flex-wrap: wrap; padding: var(--space-3) var(--space-4); border-top: 1px solid var(--ink-100); }
.pagination__info { font-size: .82rem; color: var(--ink-600); }
.pagination__pages { display: flex; gap: 4px; flex-wrap: wrap; }
.pagination__page {
    min-width: 34px; height: 34px; padding: 0 8px; border-radius: var(--radius-sm);
    border: 1px solid var(--ink-200); background: #fff; color: var(--ink-700);
    display: inline-flex; align-items: center; justify-content: center; font-size: .84rem; font-weight: 600;
}
.pagination__page:hover { background: var(--ink-050); text-decoration: none; }
.pagination__page[aria-current="page"] { background: var(--brand-primary); border-color: var(--brand-primary); color: #fff; }
.pagination__page.is-disabled { opacity: .4; pointer-events: none; }

/* --- Abas ---------------------------------------------------------------- */
.tabs { display: flex; gap: 2px; border-bottom: 2px solid var(--ink-200); margin-bottom: var(--space-5); overflow-x: auto; }
.tabs__item {
    padding: 10px 16px; font-size: .89rem; font-weight: 600; color: var(--ink-600);
    border-bottom: 2px solid transparent; margin-bottom: -2px; white-space: nowrap;
}
.tabs__item:hover { color: var(--brand-secondary); text-decoration: none; }
.tabs__item.is-active { color: var(--brand-primary); border-bottom-color: var(--brand-primary); }

/* --- Linha do tempo ------------------------------------------------------ */
.timeline { position: relative; padding-left: 30px; }
.timeline::before { content: ''; position: absolute; left: 9px; top: 6px; bottom: 6px; width: 2px; background: var(--ink-200); }
.timeline__item { position: relative; padding-bottom: var(--space-5); }
.timeline__item:last-child { padding-bottom: 0; }
.timeline__dot {
    position: absolute; left: -30px; top: 2px; width: 20px; height: 20px; border-radius: 50%;
    background: #fff; border: 2px solid var(--ink-300);
    display: flex; align-items: center; justify-content: center; font-size: .6rem;
}
.timeline__dot--brand   { border-color: var(--brand-primary); color: var(--brand-primary); }
.timeline__dot--success { border-color: var(--ok-500); color: var(--ok-500); }
.timeline__dot--warning { border-color: var(--warn-500); color: var(--warn-500); }
.timeline__dot--danger  { border-color: var(--danger-500); color: var(--danger-500); }
.timeline__header { display: flex; align-items: baseline; gap: var(--space-2); flex-wrap: wrap; }
.timeline__title { font-weight: 600; font-size: .93rem; }
.timeline__meta { font-size: .78rem; color: var(--ink-500); }
.timeline__body { font-size: .87rem; color: var(--ink-700); margin-top: 4px; }
.timeline__changes { margin-top: 8px; font-size: .82rem; background: var(--ink-050); border: 1px solid var(--ink-200); border-radius: var(--radius-sm); padding: 10px 12px; }

/* --- Lista de definição -------------------------------------------------- */
.dl { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: var(--space-4); margin: 0; }
.dl__item { min-width: 0; }
.dl__label { font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-500); font-weight: 700; margin-bottom: 2px; }
.dl__value { font-size: .92rem; color: var(--ink-900); word-break: break-word; }
.dl__value--muted { color: var(--ink-400); font-style: italic; }

/* --- Modal --------------------------------------------------------------- */
.modal-backdrop {
    position: fixed; inset: 0; background: rgba(22, 24, 29, .55);
    display: flex; align-items: center; justify-content: center; padding: var(--space-4); z-index: 300;
}
.modal-backdrop[hidden] { display: none; }
.modal {
    background: #fff; border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
    width: min(620px, 100%); max-height: calc(100vh - 60px); overflow-y: auto;
}
.modal--wide { width: min(920px, 100%); }
.modal__header { padding: var(--space-4) var(--space-5); border-bottom: 1px solid var(--ink-100); display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); }
.modal__title { margin: 0; font-size: 1.05rem; }
.modal__body { padding: var(--space-5); }
.modal__footer { padding: var(--space-4) var(--space-5); border-top: 1px solid var(--ink-100); display: flex; justify-content: flex-end; gap: var(--space-2); flex-wrap: wrap; }

/* --- Tela de login ------------------------------------------------------- */
/* ==========================================================================
   Tela de login: classes .login-page / .login-wrap / .login-box do Portal RH
   ========================================================================== */



.password-field { position: relative; }
.password-field .input { padding-right: 44px; }
.password-toggle {
    position: absolute; right: 4px; top: 4px; width: 32px; height: 32px;
    border: 0; background: none; cursor: pointer; color: var(--ink-500); border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
}
.password-toggle:hover { background: var(--ink-100); color: var(--ink-800); }

/* --- Utilitários --------------------------------------------------------- */
.muted { color: var(--ink-500); }
.small { font-size: .82rem; }
.strong { font-weight: 700; }
.nowrap { white-space: nowrap; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.numeric { font-variant-numeric: tabular-nums; }
.mt-0 { margin-top: 0; } .mt-2 { margin-top: var(--space-2); } .mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); } .mt-5 { margin-top: var(--space-5); }
.mb-0 { margin-bottom: 0; } .mb-2 { margin-bottom: var(--space-2); } .mb-3 { margin-bottom: var(--space-3); }
.mb-4 { margin-bottom: var(--space-4); } .mb-5 { margin-bottom: var(--space-5); }
.flex { display: flex; } .flex-col { flex-direction: column; }
.items-center { align-items: center; } .justify-between { justify-content: space-between; }
.gap-1 { gap: var(--space-1); } .gap-2 { gap: var(--space-2); } .gap-3 { gap: var(--space-3); } .gap-4 { gap: var(--space-4); }
.wrap { flex-wrap: wrap; }
.w-full { width: 100%; }
.hidden { display: none !important; }
.divider { height: 1px; background: var(--ink-200); margin: var(--space-4) 0; }

.stack > * + * { margin-top: var(--space-3); }

.help-box {
    background: var(--info-100); border: 1px solid color-mix(in srgb, var(--info-500) 30%, white);
    border-radius: var(--radius); padding: var(--space-3) var(--space-4);
    font-size: .85rem; color: var(--info-700); margin-bottom: var(--space-4);
}
.legal-box {
    background: var(--warn-100); border-left: 3px solid var(--warn-500);
    border-radius: var(--radius-sm); padding: var(--space-3) var(--space-4);
    font-size: .84rem; color: var(--warn-700); margin-bottom: var(--space-4);
}

/* Indicador de vencimento que não depende apenas de cor */
.due-flag { display: inline-flex; align-items: center; gap: 5px; font-weight: 600; font-size: .8rem; }
.due-flag--ok      { color: var(--ok-700); }
.due-flag--soon    { color: var(--warn-700); }
.due-flag--urgent  { color: var(--danger-700); }
.due-flag--overdue { color: var(--danger-700); text-decoration: underline; text-decoration-style: wavy; text-underline-offset: 3px; }

/* ==========================================================================
   Responsivo
   ========================================================================== */
@media (max-width: 1180px) {
    .col-3 { grid-column: span 4; }
    .col-4 { grid-column: span 6; }
}

@media (max-width: 1024px) {
    .content { padding: var(--space-4); }
}

@media (max-width: 860px) {
    /* Em telas pequenas o rail vira gaveta sobreposta. */
    .topbar__search { display: none; }
    .form-grid > [class^="col-"] { grid-column: span 12; }
    .page-header { flex-direction: column; align-items: stretch; }
    .page-header__actions { justify-content: flex-start; }
    .kpi-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
    .kpi__value { font-size: 1.5rem; }
    .flash-stack { top: 70px; right: 12px; left: 12px; width: auto; }
    .chart-bar-row { grid-template-columns: 1fr auto; }
    .chart-bar-track { grid-column: 1 / -1; }
}

@media (max-width: 620px) {
    body { font-size: 14.5px; }
    .content { padding: var(--space-3); }
    .card__body { padding: var(--space-4); }
    .user-menu__name { display: none; }
    .table th, .table td { padding: 9px var(--space-3); }
    .modal { max-height: calc(100vh - 24px); }
    .btn { padding: 0 14px; }
    .form-actions { flex-direction: column-reverse; }
    .form-actions .btn { width: 100%; }
}

/* ==========================================================================
   Impressão
   ========================================================================== */
@media print {
    .training-rail, .topbar, .footer, .page-header__actions, .filters,
    .pagination, .no-print, .flash-stack { display: none !important; }
    body { background: #fff; font-size: 11pt; }
    .content { padding: 0; max-width: none; }
    .card { border: 1px solid #ccc; box-shadow: none; page-break-inside: avoid; margin-bottom: 12pt; }
    .table thead th { background: #f0f0f0 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    a[href]::after { content: ''; }
    .badge { border: 1px solid #999; }
}

/* Respeita a preferência do sistema por menos movimento */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ==========================================================================
   Complementos do Training Rail específicos deste sistema
   ========================================================================== */

/* Contador de notificações não lidas no item do rail. */
.training-rail__badge {
    margin-left: auto;
    background: rgba(255, 255, 255, .22);
    color: #fff;
    border-radius: 999px;
    padding: 1px 7px;
    font-size: .7rem;
    font-weight: 700;
    line-height: 1.5;
}
.training-rail__item--active .training-rail__badge {
    background: var(--color-primary);
    color: #fff;
}
.training-rail--collapsed .training-rail__badge {
    position: absolute;
    top: 6px;
    right: 14px;
    margin: 0;
    padding: 0 5px;
    font-size: .62rem;
}

/* "Sair" é POST (CSRF), então é um <button> dentro de <form> — o form não pode
   interferir no layout do item. */
.training-rail__logout-form { margin: 0; display: contents; }

/* ==========================================================================
   Tela de login — padrão do Portal RH (.login-page / .login-wrap / .login-box)
   ========================================================================== */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: radial-gradient(ellipse at 60% 30%, #5a0d12 0%, #1e0305 70%);
}

.login-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 380px;
    padding: 24px 16px;
}

.login-header { display: flex; flex-direction: column; align-items: center; margin-bottom: 36px; text-align: center; }
.login-logo { width: 210px; max-width: 100%; display: block; mix-blend-mode: screen; margin-bottom: 20px; }
.login-slogan { color: #fff; font-size: 1.25rem; font-weight: 800; margin: 0; letter-spacing: .01em; }
.login-sub { margin: 8px 0 0; font-size: .82rem; font-weight: 600; color: rgba(255, 255, 255, .62); }

.login-box {
    background: rgba(255, 255, 255, .07);
    border: 1px solid rgba(255, 255, 255, .12);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    border-radius: 14px;
    padding: 32px;
    width: 100%;
}

.login-box .auth__title { color: #fff; font-size: 1.15rem; font-weight: 700; margin: 0 0 4px; }
.login-box .auth__subtitle { color: rgba(255, 255, 255, .62); font-size: .85rem; margin: 0 0 24px; }

.login-box .field { margin-bottom: 16px; }
.login-box .field__label { color: rgba(255, 255, 255, .7); font-size: .82rem; font-weight: 600; }
.login-box .field__hint { color: rgba(255, 255, 255, .5); }
.login-box .field__error { color: #ffb4b4; }
.login-box .required { color: #ff9a9a; }

.login-box .input {
    background: rgba(255, 255, 255, .1);
    border-color: rgba(255, 255, 255, .2);
    color: #fff;
}
.login-box .input::placeholder { color: rgba(255, 255, 255, .35); }
.login-box .input:focus {
    border-color: rgba(255, 255, 255, .5);
    background: rgba(255, 255, 255, .15);
    box-shadow: none;
    outline: none;
}
/* O autofill do Chrome pinta o campo de branco e destrói o efeito de vidro. */
.login-box .input:-webkit-autofill,
.login-box .input:-webkit-autofill:focus {
    -webkit-text-fill-color: #fff;
    -webkit-box-shadow: 0 0 0 1000px rgba(90, 13, 18, .92) inset;
    caret-color: #fff;
}

.login-box .password-toggle { color: rgba(255, 255, 255, .6); }
.login-box .password-toggle:hover { color: #fff; }

.auth__submit {
    display: block;
    width: 100%;
    margin-top: 20px;
    padding: 12px;
    border: none;
    border-radius: 8px;
    background: #cc1c1c;
    color: #fff;
    font: inherit;
    font-size: .95rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .2s;
}
.auth__submit:hover { background: #a01515; }
.auth__submit:disabled { opacity: .65; cursor: progress; }

.auth__links { display: flex; justify-content: center; gap: 12px; margin-top: 16px; font-size: .82rem; flex-wrap: wrap; }
.auth__links a { color: rgba(255, 255, 255, .78); text-decoration: none; font-weight: 600; }
.auth__links a:hover { color: #fff; text-decoration: underline; }

.login-footer { margin-top: 24px; font-size: .74rem; line-height: 1.5; color: rgba(255, 255, 255, .48); text-align: center; }

.login-box .alert { background: rgba(255, 255, 255, .1); border-color: rgba(255, 255, 255, .18); color: #fff; }
.login-box .alert--erro    { background: rgba(197, 48, 48, .28); border-color: rgba(255, 154, 154, .45); }
.login-box .alert--sucesso { background: rgba(47, 133, 90, .28); border-color: rgba(150, 224, 186, .45); }
.login-box .alert--aviso   { background: rgba(183, 121, 31, .28); border-color: rgba(240, 208, 150, .45); }

/* O botão de menu só existe onde o rail vira gaveta (mesmo corte do Portal RH). */
@media (max-width: 768px) {
    .topbar__toggle { display: inline-flex; }
    .topbar__search { display: none; }
}

/* ==========================================================================
   Índice de cadastros auxiliares
   ========================================================================== */
.catalog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}

.catalog-card {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 20px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    text-decoration: none;
    color: inherit;
    transition: border-color .18s, box-shadow .18s, transform .18s;
}
.catalog-card:hover {
    border-color: var(--color-primary);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
    text-decoration: none;
}

.catalog-card__icon {
    flex: none;
    width: 42px;
    height: 42px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: color-mix(in srgb, var(--color-primary) 10%, transparent);
    color: var(--color-primary);
}

.catalog-card__body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.catalog-card__title { font-size: .95rem; font-weight: 700; color: var(--color-text); }
.catalog-card__text { font-size: .82rem; color: var(--color-muted); line-height: 1.45; }

.catalog-card__count {
    margin-left: auto;
    flex: none;
    align-self: center;
    min-width: 30px;
    padding: 2px 9px;
    border-radius: 999px;
    background: var(--color-background);
    border: 1px solid var(--color-border);
    color: var(--color-muted);
    font-size: .8rem;
    font-weight: 700;
    text-align: center;
}

/* ==========================================================================
   Ajustes de shell sobre o design system

   Mantidos aqui, e não no training-rail.css, para que aquele arquivo continue
   sendo cópia fiel do Portal RH e possa ser atualizado sem merge manual.
   ========================================================================== */

/* O rail fica preso à viewport. Sem isso ele cresce até caber todos os itens,
   estica o .app-shell além de 100vh e a PÁGINA INTEIRA passa a rolar. */
.training-rail {
    position: sticky;
    top: 0;
    height: 100vh;
    align-self: flex-start;
}

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

/* O menu foi enxugado para caber sem rolagem: 4 grupos e 11 itens em tela
   cheia. A barra de rolagem some da vista — em telas muito baixas o menu
   continua rolando pela roda do mouse e pelo teclado, mas sem o trilho
   cinza atravessando o rail. */
.training-rail__nav {
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.training-rail__nav::-webkit-scrollbar { width: 0; height: 0; }

/* Itens e rótulos compactos, para o menu inteiro caber sem rolagem. */
.training-rail__item { min-height: 40px; }
.training-rail__group { padding: 12px 12px 4px; }
.training-rail__head { padding: 12px 14px 8px; min-height: 0; }
.training-rail__user { padding: 8px 10px; margin-bottom: 6px; }
.training-rail__nav > .training-rail__group:not(:first-child) { margin-top: 4px; padding-top: 10px; }
.training-rail__foot { padding: 6px 12px 12px; }
.rail-dev-credit { padding: 8px 16px 6px; }

@media (max-width: 768px) {
    /*
     * No celular o rail é uma gaveta sobreposta. Três ajustes que só fazem
     * sentido aqui:
     *
     * 1. 100dvh em vez de 100vh — no celular a 100vh conta a barra de
     *    endereço do navegador, então o rodapé do menu ("Sair" e o crédito)
     *    ficava escondido atrás dela;
     * 2. a gaveta INTEIRA rola, não só o <nav>: em tela baixa o cabeçalho e
     *    o bloco do usuário ocupam metade do espaço, e o resto precisa
     *    "descer junto";
     * 3. rolagem por toque com inércia.
     */
    .training-rail {
        position: fixed;
        align-self: auto;
        height: 100vh;
        height: 100dvh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
        scrollbar-width: none;
    }
    .training-rail::-webkit-scrollbar { width: 0; }

    /* O nav deixa de rolar sozinho — quem rola é a gaveta. */
    .training-rail__nav { overflow: visible; flex: 0 0 auto; }

    /* O rodapé acompanha o conteúdo em vez de ficar preso embaixo. */
    .training-rail__foot { margin-top: auto; }

    /* Alvos de toque confortáveis. */
    .training-rail__item { min-height: 46px; }

    /* Com a gaveta aberta, o fundo não rola atrás dela. */
    body.nav-open { overflow: hidden; }
}

/* ==========================================================================
   Bloco recolhível (<details>) — campos de uso pouco frequente
   ========================================================================== */
.details {
    border: 1px solid var(--color-border);
    border-radius: 10px;
    background: var(--color-background);
    padding: 10px 14px;
}

.details > summary {
    cursor: pointer;
    font-size: .85rem;
    font-weight: 600;
    color: var(--color-muted);
    list-style: none;
    display: flex;
    align-items: center;
    gap: 8px;
}
.details > summary::-webkit-details-marker { display: none; }

/* Seta desenhada em CSS, para não depender do marcador padrão do navegador. */
.details > summary::before {
    content: "";
    width: 6px;
    height: 6px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(-45deg);
    transition: transform .18s var(--rail-ease, ease);
    flex: none;
}
.details[open] > summary::before { transform: rotate(45deg); }
.details > summary:hover { color: var(--color-text); }
.details > summary:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; border-radius: 4px; }

/* Ação destrutiva discreta, para linhas de tabela: cor de alerta no texto,
   sem o peso do botão vermelho sólido ao lado das demais ações. */
.btn--ghost-danger { color: var(--danger-700); background: transparent; }
.btn--ghost-danger:hover { background: var(--danger-100); color: var(--danger-700); }

/* Contadores da tela Organização: o número leva à lista, o link cadastra.
   NÃO usar .kpi__link aqui — esse nome já é a setinha em position:absolute
   do canto do cartão, e reusá-lo tirava o rótulo e o número do fluxo. */
.kpi__body { display: block; text-decoration: none; color: inherit; }
.kpi__body:hover { text-decoration: none; }
.kpi__body:hover .kpi__value { color: var(--color-primary); }

.kpi__action {
    display: inline-block;
    margin-top: 10px;
    font-size: .78rem;
    font-weight: 600;
    color: var(--color-primary);
    text-decoration: none;
}
.kpi__action:hover { text-decoration: underline; }

/* Título de seção do painel: separa os blocos de indicadores. */
.section-title {
    font-size: .82rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--color-muted);
    margin: 0 0 10px;
}
.kpi-grid + .section-title { margin-top: 24px; }
