/* ==========================================================================
   TEMA SAP FIORI - Sistema de Treinamento UF (PETROBRAS)
   ========================================================================== */

:root {
    --sap-shell-bg: #354a5f;
    --sap-shell-bg-dark: #29394d;
    --sap-blue: #0a6ed1;
    --sap-blue-dark: #0854a0;
    --sap-blue-hover: #085caf;
    --sap-page-bg: #f7f7f7;
    --sap-content-bg: #ffffff;
    --sap-border: #d9d9d9;
    --sap-tile-border: #cfd7df;
    --sap-text: #32363a;
    --sap-text-muted: #6a6d70;
    --sap-link: #0a6ed1;
    --sap-negative: #bb0000;
    --sap-positive: #107e3e;
    --sap-warning: #e9730c;
    --font: "72", "72full", Arial, Helvetica, sans-serif;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: var(--font);
    background: var(--sap-page-bg);
    color: var(--sap-text);
    font-size: 14px;
}

a { color: var(--sap-link); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------------------------------------------------------------------
   SHELL HEADER (barra superior azul-escura do Fiori Launchpad)
   --------------------------------------------------------------------- */
.sap-shell-header {
    background: var(--sap-shell-bg);
    color: #fff;
    height: 44px;
    display: flex;
    align-items: center;
    padding: 0 8px;
    gap: 10px;
}

.sap-shell-header .sap-back {
    background: none;
    border: none;
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    padding: 2px 8px;
}
.sap-shell-header .sap-back:hover { background: rgba(255,255,255,.1); border-radius: 4px; }

.sap-logo {
    background: #fff;
    color: var(--sap-blue-dark);
    font-weight: 700;
    font-size: 13px;
    padding: 3px 6px;
    border-radius: 2px;
    letter-spacing: .5px;
}

.sap-shell-title {
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}
.sap-shell-title .caret { font-size: 10px; opacity: .8; }

.sap-shell-search {
    flex: 1;
    display: flex;
    justify-content: center;
}
.sap-shell-search-inner {
    display: flex;
    align-items: center;
    background: rgba(255,255,255,.12);
    border-radius: 3px;
    overflow: hidden;
    max-width: 480px;
    width: 100%;
}
.sap-shell-search-inner select {
    background: transparent;
    border: none;
    color: #fff;
    padding: 6px 6px;
    font-size: 13px;
    border-right: 1px solid rgba(255,255,255,.2);
}
.sap-shell-search-inner input {
    flex: 1;
    background: transparent;
    border: none;
    color: #fff;
    padding: 6px 8px;
    font-size: 13px;
}
.sap-shell-search-inner input::placeholder { color: rgba(255,255,255,.7); }
.sap-shell-search-inner button {
    background: transparent;
    border: none;
    color: #fff;
    padding: 6px 10px;
    cursor: pointer;
}

.sap-shell-actions {
    display: flex;
    align-items: center;
    gap: 14px;
}
.sap-avatar {
    width: 26px; height: 26px;
    border-radius: 50%;
    background: #5a7184;
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px;
    cursor: pointer;
}

/* Faixa secundária (breadcrumb / opções de exibição) */
.sap-subheader {
    background: #fff;
    border-bottom: 1px solid var(--sap-border);
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding: 6px 16px;
    font-size: 12px;
    color: var(--sap-text-muted);
    gap: 16px;
}
.sap-subheader .sap-crumb { margin-right: auto; color: var(--sap-text); font-weight: 600; }

/* ---------------------------------------------------------------------
   CONTAINER GERAL DE PÁGINA
   --------------------------------------------------------------------- */
.sap-page {
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px 32px;
}

/* ---------------------------------------------------------------------
   MENUBAR (linha de ações em texto puro — SEM fundo colorido, só
   destaque azul no texto/hover, fiel à barra superior real do SAP)
   --------------------------------------------------------------------- */
.sap-menubar {
    display: flex;
    align-items: center;
    gap: 22px;
    padding: 8px 0;
    border-bottom: 1px solid var(--sap-border);
    font-size: 12.5px;
    color: var(--sap-text);
    flex-wrap: wrap;
}
.sap-menubar span, .sap-menubar a {
    color: var(--sap-text);
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
}
.sap-menubar span:hover, .sap-menubar a:hover { color: var(--sap-blue); }
.sap-menubar .disabled { color: #b3b8bd; cursor: not-allowed; }
.sap-menubar .disabled:hover { color: #b3b8bd; }

/* Menu suspenso (ex: "Inserir ⌄") — abre uma lista de opções ANTES de
   qualquer modal/ação, replicando o comportamento real do SAP. */
.sap-dropdown-wrap { position: relative; display: inline-block; }
.sap-dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 4px;
    background: #fff;
    border: 1px solid var(--sap-border);
    box-shadow: 0 2px 10px rgba(0,0,0,.15);
    min-width: 260px;
    z-index: 60;
    padding: 4px 0;
}
.sap-dropdown-menu.open { display: block; }
.sap-dropdown-item {
    padding: 8px 14px;
    font-size: 12.5px;
    color: var(--sap-text);
    cursor: pointer;
    white-space: nowrap;
}
.sap-dropdown-item:hover { background: #f2f6fa; color: var(--sap-blue); }
.sap-dropdown-item.disabled { color: #b3b8bd; cursor: not-allowed; }
.sap-dropdown-item.disabled:hover { background: none; color: #b3b8bd; }

/* Botão "link" — texto com destaque azul, sem fundo/borda (usado em
   toolbars de lista, ex: Notificar evento) em vez de botão preenchido */
.sap-btn-link {
    background: none;
    border: 1px solid #89919a;
    border-radius: 2px;
    color: var(--sap-text);
    font-size: 13px;
    font-family: var(--font);
    padding: 6px 14px;
    height: 34px;
    cursor: pointer;
}
.sap-btn-link:hover { background: #f5f9fd; border-color: var(--sap-blue); color: var(--sap-blue-dark); }
.sap-btn-link:disabled { opacity: .5; cursor: not-allowed; }
.sap-btn-link:disabled:hover { background: none; border-color: #89919a; color: var(--sap-text); }


.sap-launchpad {
    background: var(--sap-shell-bg);
    min-height: calc(100vh - 44px);
    padding: 0 32px 48px;
}

.sap-group-tabs {
    display: flex;
    gap: 28px;
    padding: 12px 0 0;
    border-bottom: 1px solid rgba(255,255,255,.18);
    flex-wrap: wrap;
    font-size: 13px;
    margin-bottom: 4px;
}
.sap-group-tabs a {
    color: rgba(255,255,255,.72);
    text-decoration: none;
    padding-bottom: 10px;
    border-bottom: 2px solid transparent;
    white-space: nowrap;
}
.sap-group-tabs a:hover { color: #fff; }
.sap-group-tabs a.active { color: #fff; border-bottom-color: #fff; }

.sap-tile-group-title-dark {
    font-size: 13px;
    font-weight: 400;
    color: rgba(255,255,255,.85);
    margin: 28px 0 12px;
}

.sap-tile-grid-dark {
    display: grid;
    grid-template-columns: repeat(auto-fill, 176px);
    gap: 12px;
}

.sap-tile-flat {
    background: #fff;
    border-radius: 2px;
    box-shadow: 0 1px 3px rgba(0,0,0,.25);
    width: 176px;
    height: 176px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    cursor: pointer;
    color: var(--sap-text);
    text-decoration: none;
    transition: box-shadow .15s ease, transform .08s ease;
}
.sap-tile-flat:hover { box-shadow: 0 3px 10px rgba(0,0,0,.35); text-decoration: none; }
.sap-tile-flat:active { transform: translateY(1px); }
.sap-tile-flat .sap-tile-title { font-size: 15px; font-weight: 400; line-height: 1.3; color: var(--sap-text); }
.sap-tile-flat .sap-tile-icon-wrap { align-self: flex-start; color: var(--sap-blue-dark); }
.sap-tile-flat .sap-tile-icon-wrap svg { width: 34px; height: 34px; display: block; }
.sap-tile-flat .sap-tile-footer { font-size: 11px; color: var(--sap-text-muted); min-height: 14px; }

.sap-tile-flat.sap-tile-flat-disabled {
    cursor: default;
    opacity: .68;
}
.sap-tile-flat.sap-tile-flat-disabled .sap-tile-icon-wrap { color: #9aa3ab; }
.sap-tile-flat.sap-tile-flat-disabled .sap-tile-title { color: #6a6d70; }

.sap-tile-flat.sap-tile-flat-kpi .sap-tile-value { font-size: 26px; font-weight: 700; color: var(--sap-blue-dark); }


.sap-tile-group-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--sap-text);
    margin: 24px 0 10px;
    text-transform: none;
}

.sap-tile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(176px, 1fr));
    gap: 18px;
    max-width: 900px;
}

.sap-tile {
    background: #eceeef;
    border: 1px solid var(--sap-tile-border);
    border-radius: 2px;
    height: 176px;
    padding: 14px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    cursor: pointer;
    transition: box-shadow .15s ease, transform .1s ease;
    color: var(--sap-text);
}
.sap-tile:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,.15);
    text-decoration: none;
}
.sap-tile:active { transform: translateY(1px); }
.sap-tile-title { font-size: 14px; font-weight: 600; line-height: 1.3; }
.sap-tile-icon { font-size: 26px; opacity: .75; align-self: flex-start; }
.sap-tile-footer { font-size: 11px; color: var(--sap-text-muted); }
.sap-tile.sap-tile-disabled { opacity: .55; cursor: not-allowed; }
.sap-tile.sap-tile-kpi .sap-tile-value { font-size: 24px; font-weight: 700; color: var(--sap-blue-dark); }

/* ---------------------------------------------------------------------
   FORMULÁRIOS
   --------------------------------------------------------------------- */
.sap-form-row {
    display: flex;
    align-items: center;
    margin-bottom: 14px;
    gap: 12px;
}
.sap-form-label {
    width: 180px;
    min-width: 180px;
    font-size: 13px;
    color: var(--sap-text);
    text-align: right;
    padding-right: 4px;
}
.sap-form-label.required::before { content: "*"; color: var(--sap-negative); margin-right: 3px; }

.sap-input, .sap-select, select.sap-select {
    border: 1px solid #89919a;
    border-radius: 2px;
    padding: 6px 8px;
    font-size: 13px;
    font-family: var(--font);
    background: #fff;
    color: var(--sap-text);
    height: 32px;
}
.sap-input:focus, .sap-select:focus {
    outline: none;
    border-color: var(--sap-blue);
    box-shadow: 0 0 0 1px var(--sap-blue);
}
.sap-input-with-icon {
    position: relative;
    display: block;
    flex: 1 1 auto;
    max-width: 680px;
}
.sap-input-with-icon .sap-input {
    width: 100%;
    height: 30px;
    padding-right: 34px;
    border-radius: 2px;
}
.sap-input-with-icon .sap-icon-btn {
    position: absolute;
    top: 1px;
    right: 1px;
    bottom: 1px;
    width: 30px;
    border: none;
    border-left: 1px solid #c7cdd3;
    background: transparent;
    border-radius: 0 1px 1px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #5a7184;
    font-size: 14px;
}
.sap-input-with-icon .sap-icon-btn:hover { background: #eef2f6; color: var(--sap-blue-dark); }

/* ---------------------------------------------------------------------
   BOTÕES
   --------------------------------------------------------------------- */
.sap-btn {
    font-family: var(--font);
    font-size: 13px;
    padding: 6px 16px;
    border-radius: 2px;
    border: 1px solid #89919a;
    background: #fff;
    color: var(--sap-text);
    cursor: pointer;
    height: 34px;
}
.sap-btn:hover { background: #eceeef; }
.sap-btn-emphasized, .sap-btn-primary {
    background: var(--sap-blue);
    border-color: var(--sap-blue-dark);
    color: #fff;
}
.sap-btn-emphasized:hover, .sap-btn-primary:hover { background: var(--sap-blue-hover); }
.sap-btn-negative { background: #fff; border-color: var(--sap-negative); color: var(--sap-negative); }
.sap-btn:disabled { opacity: .5; cursor: not-allowed; }

.sap-toolbar {
    display: flex;
    gap: 8px;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--sap-border);
    margin-bottom: 12px;
    flex-wrap: wrap;
}
.sap-toolbar .sap-toolbar-spacer { flex: 1; }

/* ---------------------------------------------------------------------
   TABS
   --------------------------------------------------------------------- */
.sap-tabs {
    display: flex;
    border-bottom: 1px solid var(--sap-border);
    gap: 2px;
    overflow-x: auto;
    margin-bottom: 16px;
}
.sap-tab {
    padding: 10px 16px;
    font-size: 13px;
    color: var(--sap-text-muted);
    cursor: pointer;
    border-bottom: 3px solid transparent;
    white-space: nowrap;
}
.sap-tab.active {
    color: var(--sap-blue-dark);
    font-weight: 600;
    border-bottom-color: var(--sap-blue);
}
.sap-tab:hover { color: var(--sap-text); }

/* ---------------------------------------------------------------------
   TABELAS
   --------------------------------------------------------------------- */
.sap-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12.5px;
}
.sap-table th {
    background: #f2f3f4;
    text-align: left;
    padding: 8px 10px;
    border-bottom: 2px solid var(--sap-border);
    color: var(--sap-text-muted);
    font-weight: 600;
    white-space: nowrap;
}
.sap-table td {
    padding: 7px 10px;
    border-bottom: 1px solid #eef0f2;
    white-space: nowrap;
}
.sap-table tr:hover td { background: #f5f9fd; }
.sap-table tr.selected td { background: #e5f0fc; }

/* Colunas "congeladas" (não rolam com o resto da tabela) — usado na aba Etapas
   pra reproduzir o grid real do SAP, onde a Descrição da etapa fica fixa e as
   demais colunas rolam horizontalmente por baixo dela. */
.sap-col-sticky-0 { position: sticky; left: 0; z-index: 3; background: #fff; box-shadow: 2px 0 4px rgba(0,0,0,.07); }
.sap-col-checkbox { width: 34px; min-width: 34px; max-width: 34px; }
.sap-col-sticky-1 { position: sticky; left: 34px; z-index: 3; background: #fff; box-shadow: 2px 0 4px rgba(0,0,0,.07); }
thead .sap-col-sticky-0, thead .sap-col-sticky-1 { background: #f2f3f4; z-index: 4; }
tr:hover .sap-col-sticky-0, tr:hover .sap-col-sticky-1 { background: #f5f9fd; }

/* ---------------------------------------------------------------------
   MODAIS
   --------------------------------------------------------------------- */
.sap-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.35);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}
.sap-modal-overlay.open { display: flex; }

.sap-modal {
    background: #fff;
    width: 560px;
    max-width: 92vw;
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 16px 48px rgba(0,0,0,.35), 0 2px 8px rgba(0,0,0,.2);
}
.sap-modal-header {
    background: linear-gradient(180deg, #fbfbfc 0%, #f2f3f4 100%);
    border-bottom: 1px solid var(--sap-border);
    padding: 14px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 700;
    font-size: 15px;
    color: var(--sap-text);
}
.sap-modal-header .sap-modal-close {
    background: none;
    border: none;
    font-size: 17px;
    cursor: pointer;
    color: var(--sap-text-muted);
    width: 28px; height: 28px;
    border-radius: 50%;
}
.sap-modal-header .sap-modal-close:hover { background: #e5e8ea; color: var(--sap-text); }
.sap-modal-body {
    padding: 22px 20px;
    overflow-y: auto;
}
.sap-modal-body .sap-form-row { margin-bottom: 18px; }
.sap-modal-footer {
    border-top: 1px solid var(--sap-border);
    background: #fafafa;
    padding: 12px 20px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}
.sap-modal-section-divider {
    border: none;
    border-top: 1px dashed var(--sap-border);
    margin: 4px 0 18px;
}

/* Chips (para seleção múltipla, ex: Razão do evento) */
.sap-chip-input {
    border: 1px solid #89919a;
    border-radius: 2px;
    padding: 4px 6px;
    min-height: 32px;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
    background: #fff;
}
.sap-chip {
    background: #e5f0fc;
    color: var(--sap-blue-dark);
    border: 1px solid #b8d7f5;
    border-radius: 12px;
    padding: 2px 8px;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 5px;
}
.sap-chip .sap-chip-x { cursor: pointer; font-weight: 700; color: var(--sap-text-muted); }
.sap-chip-input input {
    border: none;
    outline: none;
    flex: 1;
    min-width: 80px;
    font-size: 13px;
    padding: 4px;
}

/* Lista de seleção (picklist com filtro, ex: Selecionar Razão do evento) */
.sap-picklist-search {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
}
.sap-picklist-search input { flex: 1; }
.sap-picklist-list {
    border: 1px solid var(--sap-border);
    max-height: 320px;
    overflow-y: auto;
}
.sap-picklist-item {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 7px 10px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    font-size: 13px;
}
.sap-picklist-item:hover { background: #f5f9fd; }
.sap-picklist-item strong { min-width: 180px; color: var(--sap-text); }
.sap-picklist-item span { color: var(--sap-text-muted); }

/* ---------------------------------------------------------------------
   PAINEL FLUTUANTE DE CONTATOS — estilo "Messenger" (canto inferior direito)
   --------------------------------------------------------------------- */
.sap-contatos-overlay {
    display: none; /* garantido por JS também, evita "vazar" no fluxo da página */
    position: fixed;
    inset: 0;
    background: rgba(15,20,30,0);
    pointer-events: none;
    z-index: 900;
    transition: background .2s ease;
}
.sap-contatos-overlay.open {
    background: rgba(15,20,30,.12);
    pointer-events: auto;
}
.sap-contatos-panel {
    position: fixed;
    bottom: 16px;
    right: 16px;
    width: 340px;
    max-height: 72vh;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 12px 36px rgba(20,30,50,.28), 0 2px 8px rgba(20,30,50,.12);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateY(20px) scale(.97);
    opacity: 0;
    transition: transform .22s cubic-bezier(.2,.8,.3,1), opacity .22s ease;
}
.sap-contatos-overlay.open .sap-contatos-panel {
    transform: translateY(0) scale(1);
    opacity: 1;
}
.sap-contatos-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 16px; background: linear-gradient(135deg, var(--sap-blue-dark), var(--sap-blue));
    color: #fff; font-size: 14.5px; font-weight: 700;
}
.sap-contatos-header button { color: #fff !important; opacity: .85; }
.sap-contatos-header button:hover { opacity: 1; }
.sap-contatos-links {
    display: flex; gap: 8px; padding: 10px 14px; border-bottom: 1px solid #eef0f3;
    flex-wrap: wrap; background: #fafbfc;
}
.sap-contatos-links a {
    font-size: 11.5px; font-weight: 600; background: #fff; border: 1px solid #e2e5ea; border-radius: 16px; padding: 6px 12px;
    text-decoration: none; color: var(--sap-text); transition: all .15s ease;
}
.sap-contatos-links a:hover { background: var(--sap-blue); color: #fff; border-color: var(--sap-blue); }
.sap-contatos-lista { overflow-y: auto; flex: 1; padding: 6px 0; }
.sap-contato-item {
    display: flex; align-items: center; gap: 12px; padding: 10px 16px;
    text-decoration: none; color: var(--sap-text);
}
.sap-contato-item:hover { background: #f2f6fc; }
.sap-contato-avatar-wrap { position: relative; flex-shrink: 0; }
.sap-contato-avatar, .sap-contato-avatar-placeholder {
    width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
    object-fit: cover; background: linear-gradient(135deg, var(--sap-blue), var(--sap-blue-dark)); color: #fff; font-size: 15px; font-weight: 700;
}
.sap-contato-dot {
    position: absolute; bottom: -1px; right: -1px; width: 11px; height: 11px;
    border-radius: 50%; background: #31c76a; border: 2.5px solid #fff;
}
.sap-contato-nome { font-size: 13px; font-weight: 700; color: #1c2733; }
.sap-contato-area { font-size: 11.5px; color: var(--sap-text-muted); }


.sap-message-strip {
    padding: 8px 12px;
    border-radius: 2px;
    font-size: 13px;
    margin-bottom: 16px;
    border-left: 4px solid;
}
.sap-message-strip.error { background: #ffebeb; border-color: var(--sap-negative); color: #6e0000; }
.sap-message-strip.success { background: #e9fbf0; border-color: var(--sap-positive); color: #0b5c2e; }
.sap-message-strip.info { background: #e9f4ff; border-color: var(--sap-blue); color: var(--sap-blue-dark); }

/* ---------------------------------------------------------------------
   TELA DE LOGIN
   --------------------------------------------------------------------- */
.sap-login-wrapper {
    min-height: 100vh;
    background: linear-gradient(180deg, var(--sap-shell-bg) 0%, var(--sap-shell-bg) 40%, var(--sap-page-bg) 40%);
    display: flex;
    align-items: center;
    justify-content: center;
}
.sap-login-card {
    background: #fff;
    width: 360px;
    max-width: 90vw;
    border-radius: 3px;
    box-shadow: 0 4px 24px rgba(0,0,0,.25);
    padding: 32px 28px;
}
.sap-login-logo {
    text-align: center;
    margin-bottom: 4px;
}
.sap-login-logo .sap-logo { font-size: 20px; padding: 6px 12px; }
.sap-login-subtitle {
    text-align: center;
    color: var(--sap-text-muted);
    font-size: 13px;
    margin-bottom: 24px;
}
.sap-login-card .sap-form-group { margin-bottom: 16px; }
.sap-login-card label {
    display: block;
    font-size: 12.5px;
    color: var(--sap-text-muted);
    margin-bottom: 4px;
}
.sap-login-card .sap-input { width: 100%; }
.sap-login-card .sap-btn-primary { width: 100%; margin-top: 8px; }

.sap-badge {
    display: inline-block;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    background: #eceeef;
    color: var(--sap-text-muted);
    font-weight: 600;
}
.sap-badge.admin { background: #fdf0e3; color: var(--sap-warning); }
.sap-badge.aluno { background: #e5f0fc; color: var(--sap-blue-dark); }
