/* ============================================================
   Portal Cliente COOPSOL — v2.14.0
   Área SEPARADA do CRM administrativo (assets/css/admin.css).
   Paleta baseada no protótipo Figma Make enviado pelo usuário.
   ============================================================ */
:root {
    --pc-sidebar: #1B3D50;
    --pc-primary: #3A8C42;
    --pc-dark:    #2D6B33;
    --pc-light:   #EAF5EB;
    --pc-yellow:  #F5C018;
    --pc-teal:    #26B5A8;
    --pc-red:     #E53935;
    --pc-purple:  #8B5CF6;
    --pc-text:    #1f2937;
    --pc-muted:   #6b7280;
    --pc-border:  #f3f4f6;
}

#coopsol-portal-app, #coopsol-portal-app * { box-sizing: border-box; }
#coopsol-portal-app {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    color: var(--pc-text);
    background: #f7f9fb;
    min-height: 100vh;
}
#coopsol-portal-app a { text-decoration: none; }
#coopsol-portal-app button { font-family: inherit; cursor: pointer; }
#coopsol-portal-app input, #coopsol-portal-app select {
    font-family: inherit; font-size: 14px;
}

/* ── Auth (login/cadastro) ─────────────────────────────────── */
.pc-auth-wrap {
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    padding: 24px;
    background: linear-gradient(135deg, rgba(27,61,80,.92), rgba(58,140,66,.75)),
                url('https://images.unsplash.com/photo-1509391366360-2e959784a276?auto=format&fit=crop&w=1600&q=60') center/cover;
}
.pc-auth-card {
    width: 100%; max-width: 420px; background: #fff; border-radius: 18px;
    box-shadow: 0 24px 60px rgba(0,0,0,.18); overflow: hidden;
}
.pc-auth-header { padding: 30px 32px 20px; text-align: center; }
.pc-auth-header img { max-width: 140px; margin-bottom: 10px; }
.pc-auth-header p { color: var(--pc-muted); font-size: 13px; margin: 0; }
.pc-auth-body { padding: 8px 32px 32px; }
.pc-field { margin-bottom: 14px; }
.pc-field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; color: #374151; }
.pc-field input, .pc-field select, .pc-field textarea {
    width: 100%; padding: 11px 13px; border: 2px solid #e5e7eb; border-radius: 9px;
    outline: none; transition: border-color .15s; font-family: inherit; background: #fff;
}
.pc-field textarea { resize: vertical; min-height: 90px; }
.pc-field input:focus, .pc-field select:focus, .pc-field textarea:focus { border-color: var(--pc-primary); }
.pc-field small { color: var(--pc-muted); font-size: 11px; }
.pc-btn {
    width: 100%; padding: 12px; border: none; border-radius: 9px; color: #fff;
    background: var(--pc-primary); font-weight: 700; font-size: 14px; transition: background .15s;
}
.pc-btn:hover { background: var(--pc-dark); }
.pc-btn:disabled { opacity: .6; cursor: default; }
.pc-btn-link { background: none; color: var(--pc-primary); font-weight: 600; font-size: 13px; padding: 0; width: auto; }
.pc-alert {
    padding: 10px 14px; border-radius: 8px; font-size: 13px; margin-bottom: 14px;
}
.pc-alert-error { background: rgba(229,57,53,.08); color: var(--pc-red); border: 1px solid rgba(229,57,53,.2); }
.pc-alert-ok { background: rgba(58,140,66,.1); color: var(--pc-dark); border: 1px solid rgba(58,140,66,.25); }
.pc-auth-footer { text-align: center; margin-top: 14px; font-size: 13px; color: var(--pc-muted); }
.pc-spinner {
    width: 20px; height: 20px; border: 3px solid rgba(58,140,66,.2); border-top-color: var(--pc-primary);
    border-radius: 50%; margin: 4px auto; animation: pc-spin .7s linear infinite;
}
@keyframes pc-spin { to { transform: rotate(360deg); } }

/* ── App shell (logado) ────────────────────────────────────── */
.pc-shell { display: flex; min-height: 100vh; }
.pc-sidebar {
    width: 190px; flex-shrink: 0; background: var(--pc-sidebar); color: #fff;
    display: flex; flex-direction: column; min-height: 100vh;
}
.pc-sidebar-logo { padding: 22px 18px 14px; }
.pc-sidebar-logo img { max-width: 120px; }
.pc-sidebar-divider { height: 2px; background: var(--pc-yellow); opacity: .4; margin: 0 18px 12px; border-radius: 2px; }
.pc-nav { display: flex; flex-direction: column; gap: 2px; padding: 0 10px; flex: 1; }
.pc-nav button {
    display: flex; align-items: center; gap: 10px; padding: 11px 12px; border: none; background: none;
    color: rgba(255,255,255,.75); text-align: left; border-radius: 9px; font-size: 13px; font-weight: 600;
    transition: background .15s, color .15s;
}
.pc-nav button:hover { background: rgba(255,255,255,.09); }
.pc-nav button.active { background: rgba(255,255,255,.18); color: #fff; }
.pc-sidebar-footer { padding: 14px 18px; text-align: center; font-size: 11px; opacity: .4; }
/* v2.19.6: ícones de linha (outline) da navegação — monocromáticos via
   currentColor, herdam a cor do botão (branco/translúcido na sidebar
   escura; ver .pc-bottomnav-icon/.pc-sheet-item abaixo pra mobile).
   flex-shrink evita que o ícone encolha quando o rótulo é mais longo. */
.pc-icon { flex-shrink: 0; }

.pc-main { flex: 1; min-width: 0; }
.pc-topbar {
    display: flex; align-items: center; justify-content: space-between; padding: 14px 24px;
    background: #fff; border-bottom: 1px solid var(--pc-border); position: sticky; top: 0; z-index: 5;
}
.pc-topbar-back { background: none; border: none; color: var(--pc-muted); font-size: 20px; padding: 4px 8px; border-radius: 8px; }
.pc-topbar-back:hover { background: #f3f4f6; }
.pc-topbar-actions { display: flex; gap: 12px; align-items: center; }
.pc-topbar-actions button { background: none; border: none; color: var(--pc-muted); font-size: 13px; }
.pc-topbar-actions button:hover { color: var(--pc-text); }

.pc-content { padding: 24px; max-width: 1100px; margin: 0 auto; }
.pc-content-narrow { max-width: 760px; }
.pc-h1 { font-size: 22px; font-weight: 800; text-align: center; margin: 0 0 4px; }
.pc-subtitle { text-align: center; color: var(--pc-muted); margin: 0 0 22px; font-size: 13px; }

.pc-cards-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 20px; }
.pc-card {
    background: #fff; border-radius: 16px; padding: 16px; border: 1px solid var(--pc-border);
    transition: box-shadow .15s, border-color .15s;
}
.pc-card-clickable:hover { box-shadow: 0 4px 16px rgba(0,0,0,.06); border-color: rgba(58,140,66,.35); cursor: pointer; }
.pc-card-title { font-weight: 700; font-size: 13px; color: var(--pc-primary); }
.pc-card-sub { color: var(--pc-muted); font-size: 12px; margin-top: 3px; }

.pc-fatura-item {
    background: #fff; border-radius: 16px; padding: 16px 18px; border: 1px solid var(--pc-border);
    margin-bottom: 10px; cursor: pointer; transition: border-color .15s, box-shadow .15s;
    display: flex; justify-content: space-between; align-items: flex-start; gap: 12px;
}
.pc-fatura-item:hover { border-color: rgba(58,140,66,.35); box-shadow: 0 2px 10px rgba(0,0,0,.05); }
.pc-fatura-item .pc-fatura-mes { font-weight: 700; font-size: 14px; }
.pc-fatura-item .pc-fatura-meta { color: var(--pc-muted); font-size: 12px; margin-top: 2px; }
.pc-fatura-right { text-align: right; flex-shrink: 0; }
.pc-fatura-status { font-weight: 700; font-size: 13px; }
.pc-fatura-valor { font-weight: 700; font-size: 14px; margin-top: 2px; }

.pc-status-pago { color: var(--pc-primary); }
.pc-status-pendente { color: var(--pc-yellow); }
.pc-status-vencido { color: var(--pc-red); }

.pc-search {
    position: relative; margin-bottom: 16px;
}
.pc-search input {
    width: 100%; padding: 11px 14px 11px 36px; border: 1px solid #e5e7eb; border-radius: 12px; outline: none;
}
.pc-search input:focus { border-color: var(--pc-primary); }
.pc-search::before {
    content: '🔍'; position: absolute; left: 12px; top: 50%; transform: translateY(-50%); font-size: 13px; opacity: .5;
}

.pc-detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
.pc-detail-card {
    background: #fff; border-radius: 12px; border: 1px solid var(--pc-border); border-top: 3px solid var(--pc-primary);
    padding: 12px 14px;
}
.pc-detail-card.pc-full { grid-column: 1 / -1; }
.pc-detail-label { font-size: 11px; font-weight: 600; color: var(--pc-muted); margin-bottom: 3px; }
.pc-detail-value { font-size: 13px; font-weight: 600; word-break: break-word; }

.pc-actions-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 10px; }
.pc-action-btn {
    display: flex; align-items: center; justify-content: space-between; background: #f9fafb;
    border: 1px solid var(--pc-border); border-radius: 12px; padding: 13px 16px; font-size: 13px;
    font-weight: 600; color: #374151; transition: background .15s;
}
.pc-action-btn:hover { background: #f3f4f6; }

.pc-copy-box {
    background: #f9fafb; border: 1px dashed #d1d5db; border-radius: 10px; padding: 10px 12px;
    font-size: 12px; word-break: break-all; display: flex; justify-content: space-between; gap: 10px; align-items: center;
}
.pc-copy-box button { flex-shrink: 0; background: var(--pc-primary); color: #fff; border: none; border-radius: 7px; padding: 6px 10px; font-size: 11px; font-weight: 700; }

.pc-toast {
    position: fixed; top: 16px; left: 50%; transform: translateX(-50%); z-index: 999;
    background: #1f2937; color: #fff; font-size: 13px; font-weight: 600; padding: 10px 20px; border-radius: 999px;
    box-shadow: 0 8px 24px rgba(0,0,0,.2);
}

.pc-empty { text-align: center; color: var(--pc-muted); padding: 40px 0; font-size: 13px; }
.pc-loading { text-align: center; padding: 40px 0; }

.pc-em-breve {
    text-align: center; padding: 60px 20px; color: var(--pc-muted);
}
.pc-em-breve .pc-em-breve-icon { font-size: 34px; margin-bottom: 10px; }

/* ── Contatos (Fase 4, v2.18.0) — badge de papel (Contrato/Financeiro) ── */
.pc-badge-papel {
    display: inline-block; font-size: 10.5px; font-weight: 700; padding: 2px 9px;
    border-radius: 999px; background: var(--pc-light); color: var(--pc-dark); margin-right: 6px;
}

/* ── Bottom nav + "Mais" sheet (mobile only, v2.17.0) ──────────
   Baseado no protótipo Figma Make de responsividade: sidebar
   desktop escondida em telas pequenas, substituída por uma barra
   fixa inferior com 5 abas + um painel "Mais" (bottom sheet) pros
   itens que sobram (Contatos, FAQ, Sair). Escondidos por padrão
   (desktop) e ligados dentro do media query abaixo. */
.pc-bottomnav, .pc-sheet-overlay, .pc-sheet { display: none; }

@media (max-width: 720px) {
    .pc-sidebar { display: none; }
    .pc-cards-grid { grid-template-columns: 1fr; }
    .pc-detail-grid, .pc-actions-grid { grid-template-columns: 1fr; }

    .pc-topbar { padding-top: calc(14px + env(safe-area-inset-top, 0px)); }

    /* Espaço extra embaixo do conteúdo pra não ficar atrás da bottom nav */
    .pc-main { padding-bottom: calc(58px + env(safe-area-inset-bottom, 0px)); }

    .pc-bottomnav {
        display: flex;
        position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
        background: #fff; border-top: 1px solid var(--pc-border);
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }
    .pc-bottomnav-item {
        flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
        gap: 2px; padding: 8px 4px 6px; border: none; background: none; color: #9ca3af;
        position: relative; transition: color .15s;
    }
    .pc-bottomnav-item:active { background: #f9fafb; }
    .pc-bottomnav-item.active { color: var(--pc-primary); }
    .pc-bottomnav-item.active::after {
        content: ''; position: absolute; bottom: 0; width: 28px; height: 3px;
        border-radius: 3px 3px 0 0; background: var(--pc-primary);
    }
    .pc-bottomnav-icon { font-size: 18px; line-height: 1; }
    .pc-bottomnav-label { font-size: 10px; font-weight: 700; line-height: 1; }

    .pc-sheet-overlay {
        display: block; position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.4);
    }
    .pc-sheet {
        display: block; position: fixed; left: 0; right: 0; bottom: 0; z-index: 51;
        background: #fff; border-radius: 20px 20px 0 0; box-shadow: 0 -8px 30px rgba(0,0,0,.2);
        padding-bottom: env(safe-area-inset-bottom, 16px);
    }
    .pc-sheet-handle { width: 40px; height: 4px; border-radius: 4px; background: #e5e7eb; margin: 12px auto 10px; }
    .pc-sheet-items { display: flex; flex-direction: column; gap: 2px; padding: 0 12px 12px; }
    .pc-sheet-item {
        display: flex; align-items: center; gap: 14px; width: 100%; padding: 13px 14px; border: none;
        background: none; border-radius: 14px; text-align: left; font-size: 14px; font-weight: 700;
        color: #374151;
    }
    .pc-sheet-item:active { background: #f3f4f6; }
}
