:root {
    --orange: #FF5900;
    --navy: #1a2e38;
    --teal: #284959;
    --yellow: #FFAD00;
    --bg: #f4f5f7;
    --white: #ffffff;
    --border: rgba(0,0,0,0.08);
    --border-med: rgba(0,0,0,0.12);
    --text: #1a1a1a;
    --text-2: #6b7280;
    --text-3: #9ca3af;
    --radius: 10px;
    --radius-sm: 7px;

    /* Legacy aliases (used in page-specific CSS) */
    --ng-laranja: #FF5900;
    --ng-azul: #284959;
    --ng-amarelo: #FFAD00;
    --ng-cinza: #f4f5f7;
    --ng-branco: #ffffff;
    --ng-texto-suave: #6b7280;
}

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

body {
    font-family: 'Poppins', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 14px;
    background: var(--bg);
    color: var(--text);
}

/* ── Layout shell ─────────────────────────────────────────────────── */
.app-shell {
    display: flex;
    min-height: 100vh;
}

/* ── Sidebar ──────────────────────────────────────────────────────── */
.app-sidebar {
    width: 60px;                          /* mini por padrão */
    background: var(--navy);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 50;
    transition: width 0.25s ease, box-shadow 0.25s ease;
}

/* Hover: expande como overlay (não empurra o conteúdo) */
.app-sidebar:hover {
    width: 210px;
    box-shadow: 4px 0 24px rgba(0,0,0,0.3);
}

/* Travada: expande e empurra o conteúdo */
.app-sidebar.locked {
    width: 210px;
    box-shadow: none;
}

/* Sidebar header (toggle + logo) */
.sb-header {
    height: 64px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    display: flex;
    align-items: center;
    justify-content: center;             /* mini: centralizado */
    padding: 0;
    gap: 8px;
    flex-shrink: 0;
    overflow: hidden;
    transition: padding 0.25s ease, justify-content 0.25s ease;
}

.app-sidebar:hover .sb-header,
.app-sidebar.locked .sb-header {
    justify-content: flex-start;
    padding: 0 12px;
}

/* Botão de travar */
.sb-toggle {
    background: transparent;
    border: none;
    outline: none;
    box-shadow: none;
    color: rgba(255,255,255,0.55);
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s, color 0.15s;
}

.sb-toggle:hover,
.sb-toggle:focus,
.sb-toggle:active {
    background: rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.9);
    outline: none;
    box-shadow: none;
}

/* Indicador visual: travada = laranja */
.sb-toggle[data-locked="1"] {
    color: var(--orange);
}

.sb-logo {
    display: none;                        /* mini: escondido */
    align-items: center;
    text-decoration: none;
    overflow: hidden;
    flex: 1;
    min-width: 0;
}

.app-sidebar:hover .sb-logo,
.app-sidebar.locked .sb-logo {
    display: flex;
}

.sb-logo-img {
    display: block;
    height: 28px !important;
    max-height: 28px !important;
    max-width: 150px !important;
    object-fit: contain;
    object-position: left center;
    width: auto !important;
}

.sb-section {
    padding: 12px 0 4px;
}

.sb-label {
    font-size: 9px;
    color: rgba(255,255,255,0.28);
    padding: 2px 18px 6px;
    letter-spacing: .1em;
    text-transform: uppercase;
    font-weight: 600;
    display: none;                        /* mini: escondido */
}

.app-sidebar:hover .sb-label,
.app-sidebar.locked .sb-label {
    display: block;
}

.sb-label.orange { color: rgba(255,89,0,0.6); }
.sb-label.blue   { color: rgba(135,177,198,0.6); }

/* mini: ícone centralizado */
.sb-item {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    padding: 10px 0;
    font-size: 12.5px;
    color: rgba(255,255,255,0.5);
    cursor: pointer;
    border-left: 3px solid transparent;
    transition: background .15s, color .15s, padding .15s, justify-content .15s;
    text-decoration: none;
    white-space: nowrap;
}

/* expandida: alinhado à esquerda */
.app-sidebar:hover .sb-item,
.app-sidebar.locked .sb-item {
    justify-content: flex-start;
    padding: 8px 18px;
}

.sb-item:hover {
    background: rgba(255,255,255,0.05);
    color: rgba(255,255,255,0.85);
    text-decoration: none;
}

.sb-item.active {
    background: rgba(255,89,0,0.12);
    color: #FF5900;
    font-weight: 500;
}

/* borda esquerda ativa só aparece quando expandida */
.app-sidebar:hover .sb-item.active,
.app-sidebar.locked .sb-item.active {
    border-left-color: #FF5900;
}

/* texto dos itens: escondido no mini */
.sb-item-text {
    display: none;
}

.app-sidebar:hover .sb-item-text,
.app-sidebar.locked .sb-item-text {
    display: inline;
}

.sb-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 17px;
    height: 17px;
}

.sb-icon svg {
    width: 17px;
    height: 17px;
}

.sb-divider {
    height: 1px;
    background: rgba(255,255,255,0.06);
    margin: 6px 0;
}

.sb-bottom {
    margin-top: auto;
    padding-bottom: 16px;
}

.sb-bottom form { margin: 0; }

/* mini: ícone centralizado */
.sb-logout {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    padding: 10px 0;
    font-size: 12.5px;
    color: rgba(255,255,255,0.4);
    cursor: pointer;
    border: none;
    background: transparent;
    width: 100%;
    font-family: inherit;
    transition: background .15s, color .15s, padding .15s;
    white-space: nowrap;
}

/* expandida: alinhado à esquerda */
.app-sidebar:hover .sb-logout,
.app-sidebar.locked .sb-logout {
    justify-content: flex-start;
    padding: 8px 18px;
}

.sb-logout:hover {
    background: rgba(255,255,255,0.05);
    color: rgba(255,255,255,0.75);
}

/* ── Top bar ──────────────────────────────────────────────────────── */
.app-topbar {
    background: var(--white);
    border-bottom: 1px solid var(--border);
    padding: 12px 26px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 40;
}

.tb-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    letter-spacing: -0.2px;
}

.tb-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.tb-notification-btn {
    width: 32px;
    height: 32px;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: #fff;
    color: var(--teal);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    transition: background .15s, border-color .15s, color .15s;
}

.tb-notification-btn:hover,
.tb-notification-btn.active {
    background: #eef6f8;
    border-color: #a8bfca;
}

.tb-notification-count {
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 999px;
    background: #e53935;
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    line-height: 16px;
    position: absolute;
    right: -4px;
    top: -4px;
    text-align: center;
}

.tb-notification-backdrop {
    background: transparent;
    inset: 0;
    position: fixed;
    z-index: 70;
}

.tb-notification-window {
    width: min(326px, calc(100vw - 28px));
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 18px 46px rgba(15, 23, 42, 0.16);
    color: var(--text);
    overflow: hidden;
    position: fixed;
    right: 22px;
    top: 62px;
    z-index: 80;
}

.tb-notification-window-head {
    align-items: center;
    background: #fff;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    padding: 13px 14px;
}

.tb-notification-space {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.tb-notification-window-head strong {
    color: var(--text);
    font-size: 13px;
    font-weight: 800;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tb-notification-window-head span {
    color: var(--text-2);
    font-size: 11px;
}

.tb-notification-close {
    align-items: center;
    background: transparent;
    border: 0;
    color: var(--text-2);
    cursor: pointer;
    display: inline-flex;
    font-size: 24px;
    height: 28px;
    justify-content: center;
    line-height: 1;
    padding: 0;
    width: 28px;
}

.tb-notification-close:hover {
    color: var(--text);
}

.tb-notification-window-body {
    max-height: min(420px, calc(100vh - 150px));
    overflow-y: auto;
    padding: 0 10px 10px;
    scrollbar-color: #cbd5e1 transparent;
    scrollbar-width: thin;
}

.tb-notification-section {
    color: var(--text-2);
    font-size: 12px;
    font-weight: 700;
    padding: 9px 4px 7px;
}

.tb-notification-item {
    align-items: flex-start;
    border-bottom: 1px solid var(--border);
    border-radius: 5px;
    color: var(--text);
    display: grid;
    gap: 9px;
    grid-template-columns: 30px minmax(0, 1fr) auto;
    padding: 10px 5px;
    text-decoration: none;
}

.tb-notification-item:hover {
    background: #f5f7fa;
    color: var(--text);
}

.tb-notification-item-avatar {
    align-items: center;
    background: #eef6f8;
    border: 1px solid #d4dde5;
    border-radius: 50%;
    color: var(--teal);
    display: inline-flex;
    font-size: 12px;
    font-weight: 700;
    height: 28px;
    justify-content: center;
    width: 28px;
}

.tb-notification-item-copy {
    display: grid;
    gap: 5px;
    min-width: 0;
}

.tb-notification-item-copy strong {
    color: var(--text);
    font-size: 13px;
    font-weight: 800;
    line-height: 1.35;
}

.tb-notification-item-copy small {
    color: var(--text-2);
    font-size: 12px;
    line-height: 1.35;
}

.tb-notification-item time {
    color: var(--text-2);
    font-size: 11px;
    line-height: 1.6;
    white-space: nowrap;
}

.tb-notification-empty {
    color: var(--text-2);
    font-size: 12px;
    padding: 18px 8px;
}

@media (max-width: 640px) {
    .tb-notification-window {
        right: 14px;
        top: 58px;
    }
}

.tb-username {
    font-size: 12px;
    color: var(--text-2);
    font-weight: 500;
}

.tb-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--teal);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* ── Main content area ────────────────────────────────────────────── */
.app-main {
    margin-left: 60px;                   /* mini sidebar por padrão */
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    transition: margin-left 0.25s ease;
}

/* Só empurra o conteúdo quando travada */
.app-sidebar.locked ~ .app-main {
    margin-left: 210px;
}

.app-content {
    padding: 22px 26px;
    flex: 1;
}

/* ── Alert messages ───────────────────────────────────────────────── */
.app-alerts {
    padding: 12px 26px 0;
}

/* ── Panel / card ─────────────────────────────────────────────────── */
.panel {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
}

.panel-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-2);
    letter-spacing: .05em;
    text-transform: uppercase;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}

/* ── Table ────────────────────────────────────────────────────────── */
.tbl-wrap {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.tbl {
    width: 100%;
    border-collapse: collapse;
    font-size: 12.5px;
}

.tbl th {
    padding: 10px 12px;
    text-align: left;
    font-size: 10px;
    font-weight: 600;
    color: var(--text-2);
    letter-spacing: .05em;
    text-transform: uppercase;
    border-bottom: 1px solid var(--border);
    background: #fafafa;
}

.tbl td {
    padding: 10px 12px;
    color: var(--text);
    border-bottom: 1px solid var(--border);
}

.tbl tr:last-child td { border-bottom: none; }
.tbl tbody tr:hover td { background: #fafbff; }

/* ── Pills ────────────────────────────────────────────────────────── */
.pill {
    display: inline-block;
    font-size: 10.5px;
    padding: 2px 9px;
    border-radius: 10px;
    font-weight: 500;
}

.pill-g  { background: #EAF3DE; color: #3B6D11; }
.pill-o  { background: #FFF0E8; color: #993C1D; }
.pill-b  { background: #E6F1FB; color: #185FA5; }
.pill-y  { background: #FAEEDA; color: #854F0B; }
.pill-gr { background: #f1f2f4; color: #6b7280; }
.pill-d  { background: var(--teal);   color: #fff; }
.pill-p  { background: var(--orange); color: #fff; }

/* ── Metrics grid ─────────────────────────────────────────────────── */
.metrics {
    display: grid;
    grid-template-columns: repeat(4, minmax(0,1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.mc {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
}

.mc-bar {
    width: 28px;
    height: 3px;
    border-radius: 2px;
    margin-bottom: 10px;
}

.mc-label {
    font-size: 11px;
    color: var(--text-2);
    margin-bottom: 5px;
}

.mc-val {
    font-size: 22px;
    font-weight: 600;
    color: var(--text);
    letter-spacing: -0.5px;
}

/* ── Context badge ────────────────────────────────────────────────── */
.ctx-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 11px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 500;
    margin-bottom: 18px;
}

.ctx-g { background: var(--orange); color: #fff; }
.ctx-e { background: var(--teal);   color: #fff; }

/* ── Toolbar ──────────────────────────────────────────────────────── */
.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    gap: 10px;
}

/* ── Buttons ──────────────────────────────────────────────────────── */
.btn-p {
    background: var(--orange);
    color: #fff;
    border: none;
    padding: 7px 15px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    cursor: pointer;
    font-weight: 600;
    font-family: inherit;
    transition: opacity .15s;
}

.btn-p:hover { opacity: .9; }

.btn-s {
    background: transparent;
    border: 1px solid var(--border-med);
    color: var(--text-2);
    padding: 7px 15px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    cursor: pointer;
    font-family: inherit;
    transition: background .15s;
}

.btn-s:hover { background: #f4f5f7; }

.btn-d {
    background: var(--teal);
    color: #fff;
    border: none;
    padding: 7px 15px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    cursor: pointer;
    font-weight: 600;
    font-family: inherit;
}

/* Legacy compatibility */
.btn-neogier {
    background-color: var(--orange);
    color: var(--white);
    border: none;
    font-weight: bold;
    transition: 0.3s;
    padding: 7px 15px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    cursor: pointer;
    font-family: inherit;
}

.btn-neogier:hover {
    background-color: #E65000;
    color: var(--white);
}

.btn-outline-neogier-azul {
    border: 1px solid var(--teal);
    color: var(--teal);
    background-color: transparent;
    padding: 7px 15px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    cursor: pointer;
    font-family: inherit;
}

.btn-outline-neogier-azul:hover {
    background-color: var(--teal);
    color: var(--white);
}

.card-neogier {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: none;
    background: var(--white);
}

.text-neogier-azul    { color: var(--teal); }
.text-neogier-laranja { color: var(--orange); }

/* ── Page section title ───────────────────────────────────────────── */
.page-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 18px;
    letter-spacing: -0.3px;
}

/* ── Project chips (projeto_pld_site) ────────────────────────────── */
.project-chip-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(110px, 1fr));
    gap: 12px;
    min-width: 240px;
}

.project-chip {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.project-chip strong {
    color: var(--text);
    font-size: 1.25rem;
    line-height: 1;
}

.project-chip span {
    color: var(--text-2);
    font-size: 0.9rem;
}

.project-checklist {
    display: grid;
    gap: 12px;
}

.project-checkitem {
    background-color: var(--white);
    border-left: 4px solid var(--orange);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    color: var(--text);
    border: 1px solid var(--border);
}

/* ── Mobile sidebar backdrop ─────────────────────────────────────── */
.sb-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 199;
}
.sb-backdrop.open { display: block; }

/* ── Topbar left section ─────────────────────────────────────────── */
.tb-left {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex: 1;
}

/* ── Mobile hamburger in topbar ──────────────────────────────────── */
.tb-menu-btn {
    display: none;
    width: 36px;
    height: 36px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background .15s;
}
.tb-menu-btn:hover { background: #f4f5f7; }

/* ── Sidebar close button (mobile only) ──────────────────────────── */
.sb-close {
    display: none;
    background: transparent;
    border: none;
    outline: none;
    color: rgba(255,255,255,0.6);
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background .15s, color .15s;
}
.sb-close:hover { background: rgba(255,255,255,0.08); color: #fff; }

/* ── Responsive ───────────────────────────────────────────────────── */
@media (max-width: 768px) {
    /* Sidebar vira drawer deslizante */
    .app-sidebar {
        transform: translateX(-100%);
        width: 240px !important;
        position: fixed;
        height: 100vh;
        z-index: 200;
        box-shadow: none;
        transition: transform 0.25s ease, box-shadow 0.25s ease;
    }

    /* Hover não expande no mobile — sidebar está fora da tela */
    .app-sidebar:hover {
        width: 240px !important;
        box-shadow: none;
    }

    /* Drawer aberto */
    .app-sidebar.mobile-open {
        transform: translateX(0);
        box-shadow: 4px 0 24px rgba(0,0,0,0.3);
    }

    /* Conteúdo visível quando aberto */
    .app-sidebar.mobile-open .sb-logo   { display: flex; }
    .app-sidebar.mobile-open .sb-label  { display: block; }
    .app-sidebar.mobile-open .sb-item-text { display: inline; }
    .app-sidebar.mobile-open .sb-header { justify-content: flex-start; padding: 0 12px; }
    .app-sidebar.mobile-open .sb-item,
    .app-sidebar.mobile-open .sb-logout { justify-content: flex-start; padding: 8px 18px; }
    .app-sidebar.mobile-open .sb-item.active { border-left-color: #FF5900; }

    /* Ocultar botão de travar; mostrar botão fechar no mobile */
    .sb-toggle { display: none; }
    .sb-close  { display: flex; }

    /* Mostrar hamburger no topbar */
    .tb-menu-btn { display: flex; }

    /* Título sem transbordar em telas estreitas */
    .tb-title {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    /* Main ocupa 100% */
    .app-main { margin-left: 0 !important; }

    /* Padding menor */
    .app-topbar  { padding: 10px 14px; }
    .app-content { padding: 16px 14px; }
    .app-alerts  { padding: 10px 14px 0; }

    /* Esconder nome do usuário em telas muito pequenas */
    .tb-username { display: none; }

    /* Métricas em 2 colunas */
    .metrics { grid-template-columns: repeat(2, minmax(0,1fr)); }

    /* Toolbar pode quebrar linha */
    .toolbar { flex-wrap: wrap; }

    /* Tabelas com scroll horizontal */
    .tbl-wrap { overflow-x: auto; }
}
