/*
 * Area Clientes Ratatui - layout e componentes do mockup "Área de Clientes Ratatui".
 * Cores, raios e sombras vêm de tokens.css (OfficeGest Design System).
 */

@font-face { font-family: "Inter"; font-style: normal; font-weight: 400; font-display: swap; src: url("../font/inter/inter-latin-400-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 500; font-display: swap; src: url("../font/inter/inter-latin-500-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 600; font-display: swap; src: url("../font/inter/inter-latin-600-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 700; font-display: swap; src: url("../font/inter/inter-latin-700-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 400; font-display: swap; src: url("../font/inter/inter-latin-ext-400-normal.woff2") format("woff2"); unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 500; font-display: swap; src: url("../font/inter/inter-latin-ext-500-normal.woff2") format("woff2"); unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 600; font-display: swap; src: url("../font/inter/inter-latin-ext-600-normal.woff2") format("woff2"); unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 700; font-display: swap; src: url("../font/inter/inter-latin-ext-700-normal.woff2") format("woff2"); unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }

/* Base */
body {
    background: var(--bg-app);
    color: var(--fg-1);
    font-family: Inter, var(--font-family);
    font-size: 14px;
    line-height: 1.5;
}
a { color: var(--link-color); }
a:hover, a:focus { color: var(--accent-hover); }

/* Shell */
/* Menu fixo à esquerda; só o conteúdo (#page-wrapper) e o menu fazem scroll. A topbar só existe no telemóvel. */
#wrapper.rt-shell {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
}

.rt-topbar {
    display: none;
    flex: none;
    position: relative;
    z-index: 1;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-xs);
}
.rt-topbar__brand {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    min-height: 52px;
    box-sizing: border-box;
    padding: 0 20px;
}
.rt-topbar__brand img { display: block; height: 22px; width: auto; }
.rt-topbar__menu {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    margin-left: auto;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--fg-1);
    font-size: 18px;
}

.rt-body { display: flex; flex: 1 1 auto; min-height: 0; }

.rt-sidebar {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    box-sizing: border-box;
    background: var(--blue-700);
    border-right: 1px solid var(--primary-border);
    color: var(--white);
}
.rt-nav {
    --rt-nav-pad: 12px;
    flex: 1 0 auto;
    width: 240px;
    box-sizing: border-box;
    padding: 12px 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    transition: width 260ms cubic-bezier(0.2, 0, 0, 1);
}

/* Utilizador e entidade: a toda a largura, logo abaixo do logótipo */
.rt-nav__user {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: -8px calc(-1 * var(--rt-nav-pad)) 8px;
    padding: 8px var(--rt-nav-pad) 16px;
    border-bottom: 0.5px solid rgba(255, 255, 255, 0.35);
}
.rt-nav__who { display: flex; align-items: center; gap: 8px; }
.rt-nav__name { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 13px; font-weight: 600; }
.rt-nav__name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rt-nav__avatar {
    display: none;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 999px;
    background: var(--inverse-badge-background);
    color: var(--inverse-badge-color);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.02em;
}
/* Recolher, tema e sair: no fundo do menu, acima do rodapé */
.rt-nav__actions { display: flex; align-items: center; gap: 6px; margin: auto 0 12px; }
.rt-nav__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    width: 32px;
    height: 32px;
    padding: 0;
    box-sizing: border-box;
    border-radius: var(--button-border-radius);
    border: 1px solid rgba(255, 255, 255, 0.35);
    background: transparent;
    color: var(--white);
    font-size: 14px;
    text-decoration: none;
}
.rt-nav__toggle:hover, .rt-nav__toggle:focus, .rt-nav__theme:hover, .rt-nav__theme:focus { background: rgba(255, 255, 255, 0.08); }
.rt-nav__toggle .fa { font-size: 16px; }
.rt-nav__logout { margin-left: auto; border-color: var(--danger-border); background: var(--danger-background); }
.rt-nav__logout:hover, .rt-nav__logout:focus { color: var(--white); text-decoration: none; background: var(--danger-hover-background); }
.rt-nav__entity { display: flex; flex-direction: column; gap: 4px; }
.rt-nav__entity label { margin: 0; font-size: 12px; font-weight: 600; }
.rt-nav__entity select {
    width: 100%;
    height: 32px;
    padding: 0 8px;
    border-radius: var(--input-border-radius);
    border: 1px solid var(--border-hover-color);
    background: var(--input-bg);
    color: var(--input-color);
    font-size: 13px;
}

.rt-nav__link {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 40px;
    /* Item a toda a largura do menu */
    margin: 0 calc(-1 * var(--rt-nav-pad));
    padding: 0 calc(12px + var(--rt-nav-pad));
    color: var(--white);
    font-weight: 500;
    text-decoration: none;
}
.rt-nav__link:hover, .rt-nav__link:focus { background: rgba(255, 255, 255, 0.08); color: var(--white); text-decoration: none; }
.rt-nav__link.is-active { background: var(--blue-900); box-shadow: inset 3px 0 0 var(--white); color: var(--white); font-weight: 600; }
.rt-nav__link .fa, .rt-nav__group .fa { flex: none; width: 16px; text-align: center; font-size: 15px; }
.rt-nav__link--sub { padding-left: calc(36px + var(--rt-nav-pad)); }
.rt-nav__group {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 16px;
    padding: 0 12px 4px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}
.rt-nav__group .fa { font-size: 13px; }
/* Logotipo no fundo do menu, numa faixa branca */
.rt-nav__brand {
    flex: none;
    display: flex;
    align-items: center;
    height: 64px;
    margin: -12px -12px 8px;
    padding: 0 20px;
    box-sizing: border-box;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    overflow: hidden;
}
.rt-nav__brand img { display: block; height: 24px; width: auto; }
.rt-nav__foot {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    margin: 0 -12px;
    padding: 16px 12px 0;
    border-top: 0.5px solid rgba(255, 255, 255, 0.35);
    text-align: center;
    font-size: 12px;
    line-height: 1.4;
}
.rt-nav__foot a { color: inherit; text-decoration: none; }
.rt-nav__foot a:hover, .rt-nav__foot a:focus { color: inherit; text-decoration: underline; }
.rt-nav__foot .fa-heart { font-size: 11px; }
.rt-nav__year { font-size: 11px; }

/* Menu recolhido: só ícones */
.rt-nav-collapsed .rt-nav { --rt-nav-pad: 8px; width: 64px; padding-left: 8px; padding-right: 8px; }
.rt-nav-collapsed .rt-nav__label { display: none; }
.rt-nav-collapsed .rt-nav__link { justify-content: center; }
.rt-nav-collapsed .rt-nav__link--sub { padding-left: calc(12px + var(--rt-nav-pad)); }
.rt-nav-collapsed .rt-nav__group { margin: 12px 8px 8px; padding: 0; height: 0; border-top: 1px solid rgba(255, 255, 255, 0.35); overflow: hidden; }
.rt-nav-collapsed .rt-nav__user { align-items: center; }
.rt-nav-collapsed .rt-nav__actions { flex-direction: column; }
.rt-nav-collapsed .rt-nav__logout { margin-left: 0; }
.rt-nav-collapsed .rt-nav__avatar { display: inline-flex; }
.rt-nav-collapsed .rt-nav__name, .rt-nav-collapsed .rt-nav__entity { display: none; }
.rt-nav-collapsed .rt-nav__brand { justify-content: center; margin-left: -8px; margin-right: -8px; padding: 0; }
.rt-nav-collapsed .rt-nav__foot { margin-left: -8px; margin-right: -8px; padding-left: 8px; padding-right: 8px; }
.rt-nav-collapsed .rt-nav__brand img { width: 22px; object-fit: cover; object-position: left center; }
@media (prefers-reduced-motion: reduce) {
    .rt-nav { transition: none; }
}

#page-wrapper {
    flex: 1 1 auto;
    min-width: 0;
    overflow-y: auto;
    margin: 0;
    box-sizing: border-box;
    padding: 24px 20px 48px;
    background: transparent;
    border: 0;
}

/* Página */
.rt-page {
    display: flex;
    flex-direction: column;
    gap: 24px;
}
.rt-page h1, .rt-page h2, .rt-login h1 { color: var(--fg-1); font-family: inherit; }
.rt-page-top { display: flex; flex-direction: column; gap: 8px; }
/* Cabeçalho da página (breadcrumb, título, ações) fixo no topo do conteúdo, a toda a largura. */
.rt-page > .rt-page-head:first-child, .rt-page > .rt-page-top:first-child {
    position: sticky;
    top: -24px; /* o padding do #page-wrapper conta para o sticky */
    z-index: 2;
    margin: -24px -20px 0;
    padding: 16px 20px;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-xs);
}
.rt-page-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px 16px;
}
.rt-page-top .rt-page-head { align-items: center; }
.rt-page-head__text { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.rt-page-head__title { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.rt-page-head h1 { margin: 0; font-size: 28px; line-height: 1.2; font-weight: 600; }
.rt-page-head p { margin: 0; font-size: 13px; }
.rt-page-head__actions { display: flex; flex-wrap: wrap; gap: 8px; }
.rt-overline { font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; }
.rt-breadcrumb ol {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin: 0 0 4px;
    padding: 0;
    list-style: none;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.4;
    color: var(--fg-1);
}
.rt-breadcrumb li { display: inline-flex; align-items: center; }
.rt-breadcrumb a { color: var(--fg-1); text-decoration: none; }
.rt-breadcrumb a:hover, .rt-breadcrumb a:focus { color: var(--accent-hover); text-decoration: underline; }
.rt-breadcrumb__home i { font-size: 13px; line-height: 1; }
.rt-breadcrumb__sep i { font-size: 9px; line-height: 1; }
.rt-num { font-variant-numeric: tabular-nums; }
.rt-muted { font-style: italic; }
.rt-sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Botões */
.rt-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 36px;
    padding: 0 14px;
    box-sizing: border-box;
    border-radius: var(--button-border-radius);
    border: 1px solid var(--border-hover-color);
    background: var(--bg-surface);
    color: var(--fg-1);
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    line-height: 1;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
}
.rt-btn:hover, .rt-btn:focus { background: var(--bg-hover); color: var(--fg-1); text-decoration: none; }
.rt-btn--primary {
    padding: 0 16px;
    background: var(--primary-button-background);
    border-color: var(--primary-button-border);
    color: var(--primary-button-color);
    font-weight: 600;
}
.rt-btn--primary:hover, .rt-btn--primary:focus {
    background: var(--primary-button-hover-background);
    border-color: var(--primary-button-hover-border);
    color: var(--primary-button-hover-color);
}
.rt-btn--block { display: flex; width: 100%; height: 44px; }
.rt-btn[disabled] { opacity: 0.6; cursor: default; }
.rt-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--button-border-radius);
    color: var(--primary-button-light-color);
    font-size: 15px;
    text-decoration: none;
}
.rt-icon-btn:hover, .rt-icon-btn:focus { background: var(--primary-button-light-hover-background); color: var(--primary-button-light-hover-color); text-decoration: none; }
.rt-link { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; text-decoration: none; font-variant-numeric: tabular-nums; }
.rt-link:hover { text-decoration: none; }
.rt-actions { white-space: nowrap; text-align: right; }

/* Cards */
.rt-card {
    min-width: 0;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--card-border-radius);
    box-shadow: var(--card-box-shadow);
    overflow: hidden;
}
.rt-card__head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
}
.rt-card__head h2, h2.rt-card__head { margin: 0; font-size: 16px; line-height: 1.35; font-weight: 600; }
.rt-card__head a { font-size: 13px; font-weight: 500; text-decoration: none; }
.rt-card__body { padding: 16px; }
.rt-row { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; }
.rt-row > * { flex: 1 1 320px; }
.rt-grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 460px), 1fr)); gap: 16px; align-items: start; }

/* Lista de definições (dados) */
.rt-dl {
    margin: 0;
    padding: 16px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
    gap: 16px 24px;
}
.rt-dl--stack { display: flex; flex-direction: column; gap: 16px; }
.rt-dl > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.rt-dl > .rt-dl__wide { grid-column: 1 / -1; }
.rt-dl dt { font-size: 12px; font-weight: 600; }
.rt-dl dd { margin: 0; overflow-wrap: anywhere; }
.rt-dl dd.rt-dl__big { font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; }
.rt-dl a { text-decoration: none; font-weight: 500; }

/* Tooltips (plugin do Bootstrap, iniciado em ratatui.js) */
.tooltip { font-family: Inter, var(--font-family); font-size: 12px; line-height: 1.4; }
.tooltip.in { opacity: 1; }
.tooltip-inner { max-width: 240px; padding: 4px 8px; border-radius: var(--input-border-radius); background: var(--inverse-badge-background); color: var(--inverse-badge-color); }
.tooltip.top .tooltip-arrow { border-top-color: var(--inverse-badge-background); }
.tooltip.right .tooltip-arrow { border-right-color: var(--inverse-badge-background); }
.tooltip.bottom .tooltip-arrow { border-bottom-color: var(--inverse-badge-background); }
.tooltip.left .tooltip-arrow { border-left-color: var(--inverse-badge-background); }

/* Dados do cliente */
.rt-profile { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 20px; padding: 20px; }
.rt-profile__id { display: flex; align-items: center; gap: 16px; min-width: 0; }
.rt-profile__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    width: 56px;
    height: 56px;
    border-radius: var(--card-border-radius);
    background: var(--primary-light-background);
    color: var(--primary-contrast-color);
    font-size: 24px;
}
.rt-profile__text { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.rt-profile__text h2 { margin: 0; font-size: 20px; line-height: 1.35; font-weight: 600; }
.rt-profile__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 13px; }
.rt-profile__place { display: inline-flex; align-items: center; gap: 6px; }
.rt-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 2px 4px 2px 10px;
    border-radius: 999px;
    border: 1px solid var(--border-color);
    background: var(--bg-sunken);
    font-weight: 600;
}
.rt-chip__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--fg-1);
    font-size: 12px;
}
.rt-chip__btn:hover, .rt-chip__btn:focus { background: var(--border-color); }
.rt-profile__sales {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: var(--card-border-radius);
    border: 1px solid var(--border-color);
    background: var(--bg-sunken);
}
.rt-profile__sales > div { display: flex; flex-direction: column; }
.rt-profile__avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    width: 36px;
    height: 36px;
    border-radius: 999px;
    background: var(--inverse-badge-background);
    color: var(--inverse-badge-color);
    font-size: 13px;
    font-weight: 600;
}
.rt-profile__label { font-size: 12px; font-weight: 600; }
.rt-profile__name { font-weight: 600; }
.rt-profile-row { display: flex; flex-wrap: wrap; align-items: stretch; gap: 16px; }
.rt-profile-row__main { flex: 2 1 520px; }
.rt-profile-row__side { flex: 1 1 280px; display: flex; flex-direction: column; }
.rt-contacts {
    margin: 0;
    padding: 0 16px 4px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(max(min(100%, 240px), calc((100% - 24px) / 2)), 1fr));
    column-gap: 24px;
}
.rt-contacts > div { display: flex; align-items: center; gap: 12px; min-width: 0; padding: 12px 0; border-bottom: 1px solid var(--border-color); }
.rt-contacts > div > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.rt-contacts dt { font-size: 12px; font-weight: 600; }
.rt-contacts dd { margin: 0; overflow-wrap: anywhere; }
.rt-contacts a, .rt-card__foot a { font-weight: 500; text-decoration: none; }
.rt-contacts__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    width: 36px;
    height: 36px;
    border-radius: 999px;
    background: var(--primary-light-background);
    color: var(--primary-contrast-color);
    font-size: 14px;
}
.rt-location { display: flex; gap: 12px; flex: 1 1 auto; padding: 16px; }
.rt-location address { display: flex; flex-direction: column; gap: 2px; margin: 0; font-style: normal; }
.rt-location strong { font-weight: 600; }
.rt-card__foot { padding: 12px 16px; border-top: 1px solid var(--border-color); }
.rt-callout {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 20px;
    border-radius: var(--card-border-radius);
    border: 1px solid var(--info-light-border);
    background: var(--info-light-background);
    color: var(--info-hover-color);
}
.rt-callout__text { display: flex; align-items: center; gap: 12px; }
.rt-callout__text > .fas { font-size: 20px; }
.rt-callout__text > div { display: flex; flex-direction: column; gap: 2px; }
.rt-callout h2 { margin: 0; font-size: 16px; line-height: 1.35; font-weight: 600; }
.rt-callout p { margin: 0; font-size: 13px; }
.rt-callout__btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 36px;
    padding: 0 14px;
    box-sizing: border-box;
    border-radius: var(--button-border-radius);
    border: 1px solid var(--info-border);
    background: var(--bg-surface);
    color: var(--info-hover-color);
    font-weight: 600;
    text-decoration: none;
}
.rt-callout__btn:hover, .rt-callout__btn:focus { color: var(--info-hover-color); text-decoration: none; background: var(--info-light-background); }
.rt-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr));
    gap: 16px;
    padding: 16px;
    overflow: visible;
}
.rt-stats--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.rt-stats > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.rt-stats__label { font-size: 12px; font-weight: 600; }
.rt-address { display: flex; flex-direction: column; gap: 4px; padding: 16px; overflow: visible; }
.rt-address address { margin: 0; font-style: normal; display: flex; flex-direction: column; }
.rt-totals { display: flex; justify-content: flex-end; padding: 16px; }
.rt-totals dl {
    margin: 0;
    width: 100%;
    max-width: 320px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px 16px;
    font-variant-numeric: tabular-nums;
}
.rt-totals dt { font-weight: 500; }
.rt-totals dd { margin: 0; text-align: right; }
.rt-totals .rt-totals__grand { padding-top: 8px; border-top: 1px solid var(--border-color); font-size: 18px; font-weight: 600; }

/* KPIs (dashboard) */
.rt-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 16px; }
.rt-kpi {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 16px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--card-border-radius);
    box-shadow: var(--card-box-shadow);
    color: var(--fg-1);
    text-decoration: none;
}
a.rt-kpi:hover, a.rt-kpi:focus { color: var(--fg-1); text-decoration: none; border-color: var(--border-hover-color); }
.rt-kpi__label { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; }
.rt-kpi__label .fa { width: 16px; text-align: center; font-size: 15px; color: var(--primary-button-light-color); }
.rt-kpi__value { font-size: 24px; line-height: 1.25; font-weight: 600; font-variant-numeric: tabular-nums; }
.rt-kpi__foot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 12px; font-weight: 500; color: var(--link-color); }
.rt-kpi--compact { gap: 2px; padding: 12px 16px; min-width: 180px; }
.rt-kpi--compact .rt-kpi__label { font-size: 12px; }

/* Badges */
.rt-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.5;
    white-space: nowrap;
    background: var(--secondary-badge-light-background);
    color: var(--secondary-badge-light-color);
}
.rt-badge--sm { padding: 1px 6px; font-size: 11px; }
.rt-badge--warning { background: var(--warning-badge-light-background); color: var(--warning-badge-light-color); }
.rt-badge--info { background: var(--info-light-background); color: var(--info-hover-color); }
.rt-badge--success { background: var(--success-badge-light-background); color: var(--success-badge-light-color); }
.rt-badge--primary { background: var(--primary-light-background); color: var(--primary-contrast-color); }
.rt-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; font-size: 12px; }
.rt-legend > span { display: inline-flex; align-items: center; gap: 4px; }

/* Formulários */
.rt-field { display: flex; flex-direction: column; gap: 4px; }
.rt-field label, .rt-label { margin: 0; font-size: 12px; font-weight: 600; }
.rt-input, .rt-select, .rt-dt-toolbar input, .rt-dt-toolbar select, .rt-dt-footer select {
    height: 36px;
    box-sizing: border-box;
    padding: 0 12px;
    border: 1px solid var(--border-hover-color);
    border-radius: var(--input-border-radius);
    background: var(--input-bg);
    color: var(--input-color);
    font-family: inherit;
    font-size: 13px;
    box-shadow: none;
}
.rt-select, .rt-dt-toolbar select { padding: 0 8px; }
.rt-input:focus, .rt-select:focus, .rt-dt-toolbar input:focus, .rt-dt-toolbar select:focus, .rt-dt-footer select:focus {
    outline: 0;
    border-color: var(--input-focus-border);
    box-shadow: var(--shadow-focus);
}
.rt-input--lg { height: 40px; font-size: 14px; }
.rt-inline-field { display: flex; align-items: center; gap: 8px; }
.rt-inline-field .rt-select { height: 32px; }

/* Tabelas */
.rt-table-scroll { overflow-x: auto; }
.table.rt-table { width: 100% !important; margin: 0 !important; border: 0; border-collapse: collapse; font-size: 13px; }
.table.rt-table > thead > tr > th {
    padding: 8px 12px;
    border: 0;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-sunken);
    color: var(--fg-1);
    font-size: 12px;
    font-weight: 600;
    text-align: left;
    white-space: nowrap;
    vertical-align: bottom;
}
.table.rt-table > tbody > tr > td, .table.rt-table > tbody > tr > th {
    padding: 10px 12px;
    border: 0;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}
.table.rt-table > tbody > tr > th { font-weight: 500; text-align: left; white-space: nowrap; }
.table.rt-table > tbody > tr > td.rt-num { white-space: nowrap; }
.table.rt-table > thead > tr > th:first-child, .table.rt-table > tbody > tr > td:first-child, .table.rt-table > tbody > tr > th:first-child { padding-left: 16px; }
.table.rt-table > thead > tr > th:last-child, .table.rt-table > tbody > tr > td:last-child { padding-right: 16px; }
.table.rt-table > tbody > tr:nth-of-type(even) { background: var(--table-striped); }
.table.rt-table > tbody > tr:nth-of-type(odd) { background: transparent; }
.table.rt-table > tbody > tr > td.rt-actions { padding-top: 2px; padding-bottom: 2px; }
.table.rt-table .text-right, .table.rt-table > thead > tr > th.text-right { text-align: right; }
.table.rt-table .text-center, .table.rt-table > thead > tr > th.text-center { text-align: center; }
.table.rt-table td.dataTables_empty { padding: 24px 16px; text-align: center; }
.rt-table--compact > tbody > tr > td { padding-top: 6px; padding-bottom: 6px; }
.rt-table--calendar { min-width: 900px; }
.table.rt-table--calendar > thead > tr > th:not(:first-child):not(:last-child),
.table.rt-table--calendar > tbody > tr > td:not(:first-child):not(:last-child) { padding-left: 4px; padding-right: 4px; text-align: center; }
.rt-table__rowhead { font-weight: 600; }

/* DataTables dentro de cards */
.rt-card .dataTables_wrapper { position: relative; }
.rt-dt-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
}
.rt-dt-toolbar:empty { display: none; }
.rt-dt-toolbar .dataTables_filter, .rt-dt-toolbar .dataTables_length { float: none; margin: 0; text-align: left; }
.rt-dt-toolbar .dataTables_filter { flex: 1 1 260px; max-width: 360px; }
.rt-dt-toolbar label { display: flex; flex-direction: column; gap: 4px; margin: 0; font-size: 12px; font-weight: 600; }
.rt-dt-toolbar .dataTables_filter input { width: 100%; margin: 0; }
.rt-dt-toolbar .dataTables_length label { flex-direction: row; align-items: center; gap: 8px; font-weight: 500; }
.rt-dt-toolbar .dataTables_length select { width: auto; height: 32px; }
.rt-dt-filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.rt-dt-filters[hidden] { display: none; }
.rt-dt-toolbar .rt-field label { font-weight: 600; }
.rt-dt-toolbar .rt-select { min-width: 140px; }
/* Resumo (conta corrente): grelha de 12 colunas, cada cartão ocupa 6. */
.rt-summary { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px; }
.rt-summary > .rt-kpi { grid-column: span 6; min-width: 0; }
.rt-dt-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    font-size: 13px;
}
.rt-dt-footer .dataTables_info { padding: 0; }
.rt-dt-footer .dataTables_paginate { margin: 0; }
.rt-dt-footer__end { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; }
.rt-dt-footer .dataTables_length label { display: inline-flex; align-items: center; gap: 8px; margin: 0; font-size: 13px; font-weight: 600; }
.rt-dt-footer .dataTables_length select { width: auto; height: 32px; padding: 0 8px; font-weight: 400; }
.rt-dt-footer .pagination { display: flex; gap: 8px; margin: 0; }
.rt-dt-footer .pagination > li > a, .rt-dt-footer .pagination > li > span {
    float: none;
    display: inline-flex;
    align-items: center;
    height: 32px;
    margin: 0;
    padding: 0 12px;
    border: 1px solid var(--border-hover-color);
    border-radius: var(--button-border-radius) !important;
    background: var(--bg-surface);
    color: var(--fg-1);
    font-size: 13px;
    font-weight: 500;
}
.rt-dt-footer .pagination > li > a:hover { background: var(--bg-hover); color: var(--fg-1); }
.rt-dt-footer .pagination > .active > a, .rt-dt-footer .pagination > .active > a:hover {
    background: var(--primary-light-background);
    border-color: var(--primary-light-border);
    color: var(--primary-contrast-color);
}
.rt-dt-footer .pagination > .disabled > a, .rt-dt-footer .pagination > .disabled > a:hover {
    border-color: var(--border-color);
    background: var(--bg-surface);
    color: var(--fg-1);
    font-weight: 400;
    opacity: 0.6;
}
/* Esqueleto enquanto a tabela carrega */
@keyframes rt-skel { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }
.rt-skel { display: block; height: 12px; border-radius: 4px; background: var(--border-color); animation: rt-skel 1.4s ease-in-out infinite; }
/* Valor de KPI: mesma altura da linha de 24px, sem salto quando chega o valor */
.rt-skel--value { height: 20px; margin: 5px 0; max-width: 100%; }
@media (prefers-reduced-motion: reduce) {
    .rt-skel { animation: none; }
}
.table.rt-table > tbody > tr.rt-skel-row > td { padding-top: 14px; padding-bottom: 14px; }
/* Camada sobre a página ao trocar de entidade; bloqueia cliques até ao reload */
.rt-busy-layer { position: fixed; inset: 0; z-index: 1000; background: rgba(0, 0, 0, 0.45); cursor: progress; }
.rt-dt-loading .dataTables_processing, .rt-dt-loading .dataTables_paginate { display: none !important; }
.rt-card div.dataTables_processing {
    top: 48px;
    margin-top: 0;
    padding: 8px;
    border: 1px solid var(--border-color);
    border-radius: var(--card-border-radius);
    background: var(--bg-surface);
    box-shadow: var(--shadow-md);
    font-size: 13px;
}
table.dataTable.rt-table thead .sorting:after,
table.dataTable.rt-table thead .sorting_asc:after,
table.dataTable.rt-table thead .sorting_desc:after { bottom: 8px; right: 6px; font-size: 10px; }
table.dataTable.rt-table thead > tr > th.sorting,
table.dataTable.rt-table thead > tr > th.sorting_asc,
table.dataTable.rt-table thead > tr > th.sorting_desc { padding-right: 24px; }

/* Mensagens */
.rt-alert { display: flex; gap: 8px; padding: 8px 12px; border-radius: var(--input-border-radius); font-size: 13px; }
.rt-alert--danger { background: var(--danger-light-background); border: 1px solid var(--danger-light-border); color: var(--danger-hover-color); }
.rt-alert[hidden] { display: none; }

/* Erro / sem acesso */
.rt-state { display: flex; justify-content: center; padding: 40px 0 16px; }
.rt-state__card {
    width: 100%;
    max-width: 520px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
    padding: 32px;
    overflow: visible;
}
.rt-state__card h1 { margin: 0; font-size: 28px; line-height: 1.2; font-weight: 600; }
.rt-state__card p { margin: 0; }
.rt-state__icon { font-size: 28px; color: var(--primary-button-light-color); }

/* Login */
.rt-login {
    min-height: 100vh;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 24px;
    padding: 48px 16px;
    background: var(--bg-app) url("../img/mice_ogcli.png") center / cover no-repeat fixed;
}
.rt-login__card {
    width: 100%;
    max-width: 400px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 24px;
    padding: 32px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--card-border-radius);
    box-shadow: var(--shadow-lg);
}
.rt-login__brand { display: flex; flex-direction: column; align-items: center; gap: 16px; text-align: center; }
.rt-login__brand img { display: block; height: 40px; width: auto; }
.rt-login__brand p { margin: 0; font-size: 13px; }
.rt-login form { display: flex; flex-direction: column; gap: 16px; margin: 0; }
.rt-login__help { display: flex; align-items: center; justify-content: center; gap: 8px; padding-top: 16px; border-top: 1px solid var(--border-color); font-size: 13px; }
.rt-login__help a, .rt-login__copy a { font-weight: 600; text-decoration: none; }
.rt-login__copy { margin: 0; padding: 4px 12px; border-radius: 999px; background: var(--bg-surface); font-size: 12px; }

/* Modal (gráfico das estações) */
.rt-modal .modal-content { background: var(--bg-surface); border: 1px solid var(--border-color); border-radius: var(--card-border-radius); box-shadow: var(--shadow-xl); }
.rt-modal .modal-header { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--border-color); }
.rt-modal .modal-header:before, .rt-modal .modal-header:after { display: none; }
.rt-modal .modal-title { margin: 0; font-size: 16px; font-weight: 600; }
.rt-modal .close { color: var(--fg-1); text-shadow: none; }
.rt-modal .modal-body { padding: 16px; }
.rt-modal .modal-footer { padding: 12px 16px; border-top: 1px solid var(--border-color); }

@media (max-width: 767px) {
    .rt-topbar { display: block; }
    #wrapper.rt-shell { height: auto; min-height: 100vh; overflow: visible; }
    .rt-body { flex-direction: column; }
    #page-wrapper { overflow: visible; }
    .rt-sidebar { display: none; overflow: visible; border-right: 0; border-bottom: 1px solid var(--primary-border); }
    .rt-nav-open .rt-sidebar { display: flex; }
    .rt-nav, .rt-nav-collapsed .rt-nav { --rt-nav-pad: 12px; width: 100%; padding: 12px 12px 16px; }
    .rt-nav__toggle { display: none; }
    .rt-nav-collapsed .rt-nav__label { display: inline; }
    .rt-nav-collapsed .rt-nav__link { justify-content: flex-start; }
    .rt-nav-collapsed .rt-nav__link--sub { padding-left: calc(36px + var(--rt-nav-pad)); }
    .rt-nav-collapsed .rt-nav__group { height: auto; margin: 16px 0 0; padding: 0 12px 4px; border-top: 0; overflow: visible; }
    .rt-nav-collapsed .rt-nav__user { align-items: stretch; }
    .rt-nav-collapsed .rt-nav__actions { flex-direction: row; }
    .rt-nav-collapsed .rt-nav__logout { margin-left: auto; }
    .rt-nav-collapsed .rt-nav__avatar { display: none; }
    .rt-nav-collapsed .rt-nav__foot { margin-left: -12px; margin-right: -12px; padding-left: 12px; padding-right: 12px; }
    .rt-nav-collapsed .rt-nav__name, .rt-nav-collapsed .rt-nav__entity { display: flex; }
    .rt-nav__brand { display: none; }
    #page-wrapper { padding: 16px 16px 40px; }
    .rt-page > .rt-page-head:first-child, .rt-page > .rt-page-top:first-child { position: static; margin: -16px -16px 0; padding: 16px; }
    .rt-page-head h1, .rt-state__card h1 { font-size: 24px; }
    .rt-stats--2 { grid-template-columns: minmax(0, 1fr); }
    .rt-state { padding-top: 8px; }
    .rt-state__card, .rt-login__card { padding: 24px; }
}
