/* ==================== RDO CSS ==================== */
.rdo-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    background: var(--bg-primary);
}

.rdo-hero {
    background: linear-gradient(135deg, #FF6800, #cc5500);
    color: white;
    padding: 20px 25px;
    flex-shrink: 0;
}

.rdo-hero::before,
.rdo-hero::after {
    display: none !important;
}

.rdo-hero-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.rdo-hero-title {
    display: flex;
    align-items: center;
    gap: 15px;
}

.rdo-hero-icon {
    font-size: 2.5rem;
}

.rdo-hero-title h1 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
}

.rdo-hero-title p {
    margin: 3px 0 0;
    opacity: 0.85;
    font-size: 0.9rem;
    color: rgba(255,255,255,0.85);
}

.rdo-hero-actions {
    display: flex;
    gap: 10px;
}

/* MAIN */
.rdo-main {
    display: flex;
    flex: 1;
    overflow: hidden;
    gap: 0;
}

/* LISTA */
.rdo-lista-section {
    width: 320px;
    flex-shrink: 0;
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
}

.rdo-lista-header {
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.rdo-lista-header h3 {
    margin: 0;
    font-size: 0.95rem;
    color: var(--text-primary);
}

.rdo-lista {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.rdo-lista-item {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 12px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 12px;
    border-left: 4px solid var(--border-color);
}

.rdo-lista-item:hover {
    border-color: var(--primary);
    background: var(--bg-card-hover);
    transform: translateX(3px);
}

.rdo-lista-item.hoje {
    border-left-color: var(--primary);
    background: rgba(255, 104, 0, 0.05);
}

.rdo-lista-data {
    text-align: center;
    min-width: 45px;
}

.rdo-lista-dia {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    line-height: 1;
}

.rdo-lista-mes {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.rdo-hoje-badge {
    background: var(--primary);
    color: white;
    font-size: 0.55rem;
    padding: 1px 5px;
    border-radius: 4px;
    font-weight: 700;
    margin-top: 2px;
}

.rdo-lista-info {
    flex: 1;
    min-width: 0;
}

.rdo-lista-titulo {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.rdo-clima-badge {
    font-size: 1rem;
}

.rdo-lista-sub {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.rdo-lista-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.2s;
}

.rdo-lista-item:hover .rdo-lista-actions {
    opacity: 1;
}

.rdo-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

/* EDITOR */
.rdo-editor {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.rdo-editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--primary);
}

.rdo-editor-header h3 {
    margin: 0;
    color: var(--primary);
    font-size: 1.2rem;
}

.rdo-editor-section {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 15px;
}

.rdo-editor-row {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 20px;
    align-items: start;
}

/* CLIMA */
.rdo-clima-selector {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.rdo-clima-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 10px 15px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    background: var(--bg-input);
}

.rdo-clima-btn span {
    font-size: 1.5rem;
}

.rdo-clima-btn small {
    font-size: 0.65rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.rdo-clima-btn:hover {
    border-color: var(--primary);
}

.rdo-clima-btn.active {
    border-color: var(--primary);
    background: rgba(255, 104, 0, 0.1);
}

/* REGISTROS */
.rdo-registros-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.rdo-registros-header h4 {
    margin: 0;
    color: var(--text-primary);
}

.rdo-registro-card {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 15px;
    transition: all 0.2s;
}

.rdo-registro-card:hover {
    border-color: var(--primary);
}

.rdo-registro-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark, #cc5500));
    color: white;
}

.rdo-registro-num {
    font-weight: 700;
    font-size: 0.9rem;
}

.rdo-registro-body {
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* INFO PROJETO */
.rdo-projeto-info-card {
    background: rgba(255, 104, 0, 0.05);
    border: 1px solid rgba(255, 104, 0, 0.2);
    border-radius: 8px;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.rdo-proj-info-row {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    font-size: 0.82rem;
    color: var(--text-secondary);
}

/* ATIVIDADES */
.rdo-atividades label {
    display: block;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.rdo-atividade-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.rdo-atividade-num {
    color: var(--primary);
    font-weight: 700;
    font-size: 0.85rem;
    min-width: 20px;
}

.rdo-atividade-row input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 0.9rem;
    transition: border-color 0.2s;
}

.rdo-atividade-row input:focus {
    outline: none;
    border-color: var(--primary);
}

.rdo-remove-ativ {
    width: 24px;
    height: 24px;
    border: none;
    border-radius: 50%;
    background: rgba(231, 76, 60, 0.15);
    color: var(--danger);
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.rdo-remove-ativ:hover {
    background: var(--danger);
    color: white;
}

.rdo-add-ativ-btn {
    background: none;
    border: 1px dashed var(--border-color);
    border-radius: 6px;
    color: var(--text-muted);
    padding: 6px 12px;
    cursor: pointer;
    font-size: 0.82rem;
    width: 100%;
    transition: all 0.2s;
    margin-top: 5px;
}

.rdo-add-ativ-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(255, 104, 0, 0.05);
}

.rdo-empty-registros {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
    border: 2px dashed var(--border-color);
    border-radius: 10px;
}

.rdo-editor-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
}

/* VISUALIZAÇÃO */
.rdo-cabecalho {
    display: flex;
    align-items: center;
    gap: 20px;
    border-bottom: 3px solid var(--primary);
    padding-bottom: 15px;
    margin-bottom: 20px;
}

.rdo-cabecalho-info {
    flex: 1;
}

.rdo-cabecalho-info h2 {
    margin: 0 0 5px;
    font-size: 1.1rem;
    color: var(--primary);
}

.rdo-cabecalho-info p {
    margin: 2px 0;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.rdo-cabecalho-rdo {
    text-align: center;
    background: var(--primary);
    color: white;
    padding: 10px 20px;
    border-radius: 8px;
    min-width: 120px;
}

.rdo-cabecalho-titulo {
    font-size: 1.5rem;
    font-weight: bold;
}

.rdo-cabecalho-data { font-size: 0.9rem; }
.rdo-cabecalho-contrato { font-size: 0.7rem; opacity: 0.85; margin-top: 3px; }

.rdo-sem-logo {
    font-size: 3rem;
    color: var(--primary);
}

.rdo-resumo-dia {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

.rdo-resumo-item {
    flex: 1;
    background: var(--bg-input);
    border-radius: 8px;
    padding: 10px;
    text-align: center;
    border: 1px solid var(--border-color);
}

.rdo-resumo-label {
    display: block;
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.rdo-resumo-valor {
    display: block;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--primary);
}

.rdo-registros-view {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 20px;
}

.rdo-registro-view {
    border: 1px solid var(--border-color);
    border-radius: 10px;
    overflow: hidden;
}

.rdo-registro-view.lv {
    border-color: var(--warning);
}

.rdo-registro-view-header {
    background: var(--bg-input);
    padding: 12px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    flex-wrap: wrap;
    gap: 10px;
}

.rdo-registro-view-equipe {
    display: flex;
    align-items: center;
    gap: 10px;
}

.rdo-registro-view-icon { font-size: 1.5rem; }

.rdo-registro-view-equipe strong {
    display: block;
    color: var(--text-primary);
}

.rdo-registro-view-equipe small {
    color: var(--text-muted);
    font-size: 0.75rem;
}

.rdo-registro-view-projeto {
    text-align: right;
}

.rdo-registro-view-projeto strong {
    display: block;
}

.rdo-registro-view-projeto small {
    color: var(--text-muted);
    font-size: 0.75rem;
}

.rdo-registro-view-us {
    display: flex;
    gap: 20px;
    padding: 8px 15px;
    background: rgba(255, 104, 0, 0.05);
    border-bottom: 1px solid var(--border-color);
    font-size: 0.82rem;
    flex-wrap: wrap;
}

.rdo-atividades-view {
    padding: 12px 15px;
}

.rdo-atividades-view strong {
    display: block;
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.rdo-atividades-lista {
    margin: 0;
    padding-left: 20px;
}

.rdo-atividades-lista li {
    margin-bottom: 5px;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.rdo-obs-view {
    background: rgba(255, 104, 0, 0.05);
    border-left: 4px solid var(--primary);
    padding: 12px 15px;
    border-radius: 0 8px 8px 0;
    margin: 15px 0;
    color: var(--text-primary);
}

.rdo-obs-view strong {
    display: block;
    margin-bottom: 5px;
    color: var(--primary);
}

.rdo-assinatura {
    margin-top: 40px;
    border-top: 1px solid var(--border-color);
    padding-top: 20px;
}

.rdo-assinatura-linha {
    display: flex;
    gap: 40px;
    justify-content: center;
    margin-bottom: 15px;
}

.rdo-assinatura-item {
    text-align: center;
    min-width: 180px;
}

.rdo-assinatura-espaco {
    border-bottom: 1px solid var(--text-secondary);
    height: 40px;
    margin-bottom: 5px;
}

.rdo-assinatura-item p {
    margin: 0;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.rdo-assinatura-data {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.8rem;
}

/* CONFIG */
.rdo-config-section {
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.rdo-config-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.rdo-config-section h4 {
    margin: 0 0 12px;
    color: var(--primary);
    font-size: 0.95rem;
}

.rdo-logo-area {
    min-height: 80px;
    background: var(--bg-input);
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
}

.rdo-logo-placeholder {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.rdo-projeto-padrao-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: var(--bg-input);
    border-radius: 6px;
    margin-bottom: 6px;
    border-left: 3px solid var(--primary);
}

.rdo-busca-projetos {
    border: 1px solid var(--border-color);
    border-radius: 6px;
    margin-top: 5px;
    overflow: hidden;
    max-height: 200px;
    overflow-y: auto;
}

.rdo-busca-projeto-item {
    padding: 8px 12px;
    cursor: pointer;
    transition: background 0.2s;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

.rdo-busca-projeto-item:last-child {
    border-bottom: none;
}

.rdo-busca-projeto-item:hover {
    background: var(--bg-card-hover);
}

/* Responsivo */
@media (max-width: 900px) {
    .rdo-main { flex-direction: column; }
    .rdo-lista-section { width: 100%; max-height: 250px; border-right: none; border-bottom: 1px solid var(--border-color); }
    .rdo-editor-row { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
    .rdo-assinatura-linha { flex-direction: column; align-items: center; }
    .rdo-resumo-dia { flex-wrap: wrap; }
    .rdo-hero-content { flex-direction: column; }
}

/* Se o header tiver 65px de altura */
#page-rdo .rdo-container,
#page-equipes .eq-container {
    padding-top: 0;
    margin-top: 0;
}

/* ==================== FIX HEADER OVERLAP - RDO E EQUIPES ==================== */
#page-rdo .rdo-container,
#page-equipes .eq-container {
    height: calc(100vh - 65px);
    overflow: hidden;
}

#page-rdo .rdo-hero,
#page-equipes .eq-hero {
    flex-shrink: 0;
}

/* ==================== FIX SCROLL RDO ==================== */
.rdo-main {
    display: flex;
    flex: 1;
    overflow: hidden; /* Impede scroll da página */
    min-height: 0;
}

.rdo-lista-section {
    width: 320px;
    flex-shrink: 0;
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
    overflow: hidden; /* Importante */
}

.rdo-lista {
    flex: 1;
    overflow-y: auto; /* Scroll só na lista */
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.rdo-editor {
    flex: 1;
    overflow: hidden; /* Impede scroll da página */
    display: flex;
    flex-direction: column;
    background: var(--bg-primary);
}

.rdo-editor-vazio {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    text-align: center;
}

.rdo-editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 2px solid var(--primary);
    background: var(--bg-card);
    flex-shrink: 0; /* Não encolhe */
}

.rdo-editor-header h3 {
    margin: 0;
    color: var(--primary);
}

/* SCROLL APENAS NO CONTEÚDO DO EDITOR */
.rdo-editor-scroll {
    flex: 1;
    overflow-y: auto; /* Scroll só aqui */
    padding: 20px;
}

.rdo-editor-section {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 15px;
}

.rdo-editor-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 15px 0;
    border-top: 1px solid var(--border-color);
    margin-top: 5px;
}

/* Projetos padrão */
.rdo-projetos-abertos-lista {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
}

.rdo-proj-aberto-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    cursor: pointer;
    transition: background 0.2s;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

.rdo-proj-aberto-item:last-child {
    border-bottom: none;
}

.rdo-proj-aberto-item:hover {
    background: var(--bg-card-hover);
}

.rdo-projetos-abertos-lista {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

/* ==================== OBRAS EM ANDAMENTO NO EDITOR ==================== */
.rdo-obras-count {
    background: var(--primary);
    color: white;
    padding: 2px 10px;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 600;
}

.rdo-obras-aberto-lista {
    max-height: 350px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.rdo-obra-aberto-card {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px;
    transition: all 0.2s;
    border-left: 3px solid var(--primary);
}

.rdo-obra-aberto-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--primary);
}

.rdo-obra-info {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.rdo-obra-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.rdo-obra-detalhes {
    display: flex;
    gap: 12px;
    font-size: 0.78rem;
    color: var(--text-muted);
    flex-wrap: wrap;
}

.rdo-obra-us {
    display: flex;
    gap: 12px;
    font-size: 0.78rem;
    flex-wrap: wrap;
}

.rdo-obra-progress {
    height: 4px;
    background: var(--bg-card);
    border-radius: 2px;
    overflow: hidden;
    margin-top: 3px;
}

.rdo-obra-progress-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.4s;
}

/* ==================== TOGGLE ==================== */
.rdo-toggle-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.rdo-toggle {
    width: 44px;
    height: 24px;
    background: var(--border-color);
    border-radius: 12px;
    position: relative;
    transition: all 0.3s;
    flex-shrink: 0;
}

.rdo-toggle::after {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    background: white;
    border-radius: 50%;
    top: 3px;
    left: 3px;
    transition: all 0.3s;
    box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}

.rdo-toggle.ativo {
    background: var(--success);
}

.rdo-toggle.ativo::after {
    left: 23px;
}

/* ==================== TABELA OBRAS NO RELATÓRIO ==================== */
.rdo-obras-relatorio {
    margin: 25px 0;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    overflow: hidden;
    page-break-inside: avoid;
}

.rdo-obras-relatorio-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark, #cc5500));
    color: white;
}

.rdo-obras-relatorio-header h3 {
    margin: 0;
    font-size: 1rem;
    color: white;
}

.rdo-obras-relatorio-header span {
    background: rgba(255,255,255,0.2);
    padding: 3px 10px;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 600;
}

.rdo-obras-tabela {
    width: 100%;
    border-collapse: collapse;
}

.rdo-obras-tabela th {
    background: var(--bg-input);
    padding: 10px 8px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-align: left;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    border-bottom: 2px solid var(--border-color);
    white-space: nowrap;
}

.rdo-obras-tabela td {
    padding: 8px;
    font-size: 0.82rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    white-space: nowrap;
}

.rdo-obras-tabela tbody tr:hover {
    background: var(--bg-card-hover);
}

.rdo-obras-tabela tfoot td {
    background: var(--bg-input);
    font-size: 0.85rem;
    border-top: 2px solid var(--primary);
    padding: 10px 8px;
}

.rdo-status-tag {
    font-size: 0.75rem;
    font-weight: 600;
}

.rdo-tabela-progress {
    width: 50px;
    height: 5px;
    background: var(--bg-card);
    border-radius: 3px;
    overflow: hidden;
    display: inline-block;
    vertical-align: middle;
    margin-right: 5px;
}

.rdo-tabela-progress-fill {
    height: 100%;
    border-radius: 3px;
}

.rdo-obras-relatorio {
    page-break-before: auto;
    page-break-inside: auto; /* permite quebrar dentro da tabela */
}

/* ==================== PROJETO POR ENCARREGADO ==================== */
.rdo-projetos-enc {
    background: var(--bg-input);
    border-radius: 8px;
    padding: 10px;
    margin-top: 10px;
}

.rdo-projeto-enc-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 10px;
    border-left: 3px solid var(--primary);
}

.rdo-projeto-enc-card:last-child {
    margin-bottom: 0;
}

.rdo-projeto-enc-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

/* Visualização */
.rdo-registro-view-header {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark, #cc5500));
    padding: 8px 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: none;
}

.rdo-projeto-view-item {
    border-top: 1px solid var(--border-color);
}

.rdo-projeto-view-header {
    background: rgba(255,104,0,0.05);
    padding: 6px 12px;
    border-bottom: 1px solid var(--border-color);
}

.rdo-projeto-view-header strong {
    color: var(--primary);
    font-size: 0.9rem;
}

.rdo-projeto-view-header div {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 2px;
}