/* =========================================================
   VARIÁVEIS GERAIS
   ========================================================= */
:root {
    /* Cores base */
    --bg-body: #f3f4f6;
    --bg-shell: #f3f4f6;
    --bg-card: #ffffff;
    --bg-card-soft: #f9fafb;

    --text-main: #111827;
    --text-muted: #6b7280;
    --text-contrast: #f9fafb;

    --accent: #ff7a1a;
    --accent-soft: rgba(255, 122, 26, 0.16);
    --accent-hover: #ff8f3d;

    --border-soft: #e5e7eb;
    --input-bg: #f9fafb;
    --input-border: #d1d5db;

    /* Sidebar */
    --sidebar-bg: #111827;
    --sidebar-bg-active: #0b1120;
    --sidebar-border: #020617;
    --sidebar-text: #e5e7eb;
    --sidebar-muted: #9ca3af;

    /* Sombras e raio */
    --shadow-card-soft: 0 4px 14px rgba(15, 23, 42, 0.06);
    --shadow-card-strong: 0 18px 40px rgba(15, 23, 42, 0.12);
    --radius-lg: 18px;
    --radius-xl: 26px;
    --radius-full: 999px;

    /* Transições */
    --transition-fast: 0.16s ease-out;
    --transition-med: 0.22s ease-out;
}

/* =========================================================
   RESET
   ========================================================= */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
    margin: 0;
    padding: 0;
}

body {
    font-family: "Poppins", system-ui, -apple-system, BlinkMacSystemFont,
        "Segoe UI", sans-serif;
    background: var(--bg-body);
    color: var(--text-main);
    -webkit-font-smoothing: antialiased;
}

/* =========================================================
   LOGIN (index.php)
   ========================================================= */

/* fundo escuro só é usado no login, pois só lá existe .page-bg */
.page-bg {
    position: fixed;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(circle at top, rgba(15, 23, 42, 0.9) 0, #020617 55%),
        radial-gradient(circle at bottom right, rgba(15, 23, 42, 0.9) 0, #020617 60%);
    opacity: 0.98;
    z-index: -1;
}

/* wrapper login */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
}

/* card login */
.auth-card {
    width: 100%;
    max-width: 520px;
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-card-strong);
    padding: 32px 32px 28px;
    position: relative;
}

.auth-card::before {
    content: "";
    position: absolute;
    inset: -2px;
    border-radius: inherit;
    background: radial-gradient(circle at bottom left, rgba(255, 122, 26, 0.14), transparent 60%);
    z-index: -1;
}

/* header login */
.auth-header {
    display: flex;
    align-items: center;
    gap: 18px;
    margin-bottom: 24px;
}

.auth-logo img {
    width: 64px;
    height: auto;
    display: block;
}

.auth-title-group {
    flex: 1;
}

.auth-title {
    margin: 0 0 4px;
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: #111827;
}

.auth-subtitle {
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--text-muted);
}

/* ALERTAS DE LOGIN */
.auth-alert {
    margin-bottom: 12px;
    padding: 8px 12px;
    border-radius: 10px;
    font-size: 0.8rem;
    line-height: 1.5;
    border: 1px solid transparent;
}

.auth-alert-erro {
    background: #fef2f2;
    border-color: #fecaca;
    color: #b91c1c;
}

.auth-alert-permissao {
    background: #fefce8;
    border-color: #fef3c7;
    color: #92400e;
}

.auth-alert-timeout {
    background: #eff6ff;
    border-color: #bfdbfe;
    color: #1d4ed8;
}

.auth-alert-sucesso {
    background: #ecfdf3;
    border-color: #bbf7d0;
    color: #047857;
}

/* formulário login */
.auth-form {
    margin-top: 8px;
}

.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #4b5563;
    margin-bottom: 6px;
}

.form-control {
    width: 100%;
    border-radius: var(--radius-full);
    border: 1px solid var(--input-border);
    background-color: var(--input-bg);
    padding: 10px 14px;
    font-size: 0.9rem;
    color: var(--text-main);
    outline: none;
    transition:
        border-color var(--transition-fast),
        box-shadow var(--transition-fast),
        background-color var(--transition-fast),
        transform 0.04s ease-out;
}

.form-control::placeholder {
    color: #9ca3af;
}

.form-control:focus {
    border-color: var(--accent);
    background-color: #ffffff;
    box-shadow: 0 0 0 1px rgba(255, 122, 26, 0.55),
        0 10px 25px rgba(15, 23, 42, 0.14);
    transform: translateY(-1px);
}

/* senha com botão de olho */
.password-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.btn-eye {
    position: absolute;
    right: 10px;
    width: 26px;
    height: 26px;
    border-radius: 999px;
    border: none;
    background: transparent;
    cursor: pointer;
    padding: 0;
    outline: none;
}

.btn-eye::before,
.btn-eye::after {
    content: "";
    position: absolute;
    inset: 7px 5px;
    border-radius: 999px;
    border: 2px solid #9ca3af;
    opacity: 0.85;
}

.btn-eye::after {
    inset: 11px 9px;
    border-width: 3px;
    border-color: #9ca3af;
    border-radius: 999px;
}

.btn-eye:hover::before,
.btn-eye:hover::after {
    border-color: var(--accent);
}

/* linha com botão + link */
.form-footer-row {
    margin-top: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

/* botão padrão */
.btn {
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    padding: 11px 26px;
    border-radius: var(--radius-full);
    transition:
        background-color var(--transition-med),
        box-shadow var(--transition-med),
        transform 0.08s ease-out;
}

.btn-primary {
    background: var(--accent);
    color: #111827;
    box-shadow:
        0 10px 30px rgba(255, 122, 26, 0.45),
        0 0 0 6px var(--accent-soft);
}

.btn-primary:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow:
        0 16px 45px rgba(255, 122, 26, 0.5),
        0 0 0 7px rgba(255, 122, 26, 0.2);
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow:
        0 6px 18px rgba(255, 122, 26, 0.35),
        0 0 0 5px rgba(255, 122, 26, 0.16);
}

/* link "esqueci minha senha" */
.link-forgot {
    font-size: 0.83rem;
    color: #6b7280;
    text-decoration: none;
    white-space: nowrap;
    transition: color var(--transition-fast), text-decoration-color var(--transition-fast);
}

.link-forgot:hover {
    color: var(--accent);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
}

/* rodapé login */
.auth-footer {
    margin-top: 20px;
    padding-top: 14px;
    border-top: 1px solid var(--border-soft);
}

.auth-note {
    margin: 0;
    font-size: 0.78rem;
    line-height: 1.6;
    color: var(--text-muted);
}

.auth-note a {
    color: var(--accent);
    font-weight: 600;
    text-decoration: none;
}

.auth-note a:hover {
    text-decoration: underline;
}

/* responsivo login */
@media (max-width: 640px) {
    .auth-card {
        padding: 22px 18px 20px;
        border-radius: 22px;
    }

    .auth-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .auth-logo img {
        width: 56px;
    }

    .auth-title {
        font-size: 1.35rem;
    }

    .form-footer-row {
        flex-direction: column;
        align-items: stretch;
    }

    .btn-primary {
        width: 100%;
        text-align: center;
        justify-content: center;
    }

    .link-forgot {
        text-align: center;
    }
}

/* =========================================================
   LAYOUT DO PAINEL (dashboard, clientes, boletos, etc.)
   ========================================================= */

/* container geral do app – cobre tanto .layout-shell quanto .app-shell */
.layout-shell,
.app-shell {
    min-height: 100vh;
    display: flex;
    background: var(--bg-shell);
}

/* SIDEBAR */
.sidebar,
.app-sidebar {
    width: 250px;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--sidebar-border);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
}

.sidebar-logo-area {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 18px 18px 14px;
    border-bottom: 1px solid rgba(15, 23, 42, 0.9);
}

.sidebar-logo-area img {
    width: 36px;
    height: auto;
}

.sidebar-title {
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 0.04em;
}

/* subtítulo sob o nome do painel */
.sidebar-subtitle {
    font-size: 0.72rem;
    color: var(--sidebar-muted);
    margin-top: 2px;
}

.sidebar-section-label {
    margin: 16px 18px 6px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--sidebar-muted);
}

.sidebar-nav {
    padding: 0 10px 16px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    margin: 2px 0;
    border-radius: 999px;
    color: var(--sidebar-text);
    font-size: 0.85rem;
    text-decoration: none;
    transition: background-color var(--transition-fast), color var(--transition-fast),
        transform 0.06s ease-out;
}

.sidebar-link span.icon {
    display: inline-flex;
    width: 18px;
    justify-content: center;
}

.sidebar-link:hover {
    background: rgba(31, 41, 55, 0.85);
    transform: translateX(1px);
}

.sidebar-link.active {
    background: linear-gradient(90deg, var(--accent), #ffb062);
    color: #111827;
    font-weight: 600;
}

/* rodapé da sidebar com usuário */
.sidebar-footer {
    margin-top: auto;
    padding: 12px 16px 18px;
    border-top: 1px solid rgba(15, 23, 42, 0.9);
    font-size: 0.8rem;
    color: var(--sidebar-muted);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
}

.sidebar-user-avatar {
    width: 26px;
    height: 26px;
    border-radius: 999px;
    background: #f97316;
    color: #111827;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.82rem;
    font-weight: 600;
}

.sidebar-user-info strong {
    display: block;
    color: var(--sidebar-text);
}

.sidebar-logout {
    display: inline-flex;
    margin-top: 4px;
    color: #fca5a5;
    text-decoration: none;
}

.sidebar-logout:hover {
    text-decoration: underline;
}

/* ÁREA PRINCIPAL */
.layout-main,
.app-main {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.main-header,
.app-topbar {
    background: #ffffff;
    border-bottom: 1px solid var(--border-soft);
    padding: 16px 28px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.main-header-title {
    font-size: 1.05rem;
    font-weight: 600;
    color: #111827;
}

.main-header-subtitle {
    font-size: 0.82rem;
    color: var(--text-muted);
}

/* layout interno da topbar */
.topbar-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* botão hamburguer (fica escondido no desktop, aparece no mobile) */
.btn-menu-toggle {
    display: none; /* mobile sobrescreve */
    width: 34px;
    height: 34px;
    border-radius: 999px;
    border: 1px solid var(--border-soft);
    background: #ffffff;
    padding: 0 9px;
    cursor: pointer;
    outline: none;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
}

.btn-menu-toggle span {
    display: block;
    height: 2px;
    border-radius: 999px;
    background: #111827;
}

/* chip de usuário e botão sair */
.topbar-user-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 10px;
    border-radius: 999px;
    background: #f3f4f6;
}

.avatar-circle {
    width: 26px;
    height: 26px;
    border-radius: 999px;
    background: #f97316;
    color: #111827;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.82rem;
    font-weight: 600;
}

.user-text {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
}

.user-name {
    font-size: 0.82rem;
    font-weight: 600;
}

.user-role {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.btn-logout {
    border-radius: 999px;
    border: 1px solid #fecaca;
    background: #fef2f2;
    color: #b91c1c;
    font-size: 0.78rem;
    padding: 6px 14px;
    text-decoration: none;
    font-weight: 500;
}

.btn-logout:hover {
    background: #fee2e2;
}

/* backdrop do menu mobile (off por padrão) */
.sidebar-backdrop {
    display: none;
}


.main-header-title {
    font-size: 1.05rem;
    font-weight: 600;
    color: #111827;
}

.main-header-subtitle {
    font-size: 0.82rem;
    color: var(--text-muted);
}

/* Usuário + logout na topbar */
.app-topbar {
    background: #ffffff;
    border-bottom: 1px solid var(--border-soft);
    padding: 14px 28px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.main-header-left {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 8px;
}

.topbar-user-avatar {
    width: 30px;
    height: 30px;
    border-radius: 999px;
    background: #f97316;
    color: #111827;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 600;
}

.topbar-user-info {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.topbar-user-name {
    font-size: 0.85rem;
    font-weight: 500;
    color: #111827;
}

.topbar-user-role {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.topbar-logout-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 7px 14px;
    border-radius: var(--radius-full);
    border: 1px solid #fecaca;
    background: #fef2f2;
    font-size: 0.8rem;
    font-weight: 500;
    color: #b91c1c;
    text-decoration: none;
    transition:
        background-color var(--transition-fast),
        border-color var(--transition-fast),
        color var(--transition-fast),
        transform 0.04s ease-out;
}

.topbar-logout-btn:hover {
    background: #fee2e2;
    border-color: #fca5a5;
    transform: translateY(-1px);
}

.topbar-logout-btn:active {
    transform: translateY(0);
}


/* conteúdo */
.page-content,
.app-content {
    flex: 1;
    padding: 20px 28px 22px;
}

/* fundo claro por trás do conteúdo */
.page-content-inner {
    min-height: calc(100vh - 120px);
}

/* GRID DE CARDS */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
}

/* card estatística */
.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-soft);
    box-shadow: var(--shadow-card-soft);
    padding: 16px 18px 14px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.stat-card--highlight {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px rgba(255, 122, 26, 0.45),
        0 16px 40px rgba(15, 23, 42, 0.12);
}

.stat-card-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #6b7280;
    margin-bottom: 4px;
}

.stat-card-value {
    font-size: 1.55rem;
    font-weight: 700;
    color: #111827;
    margin-bottom: 4px;
}

.stat-card-sub {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* =========================================================
   DASHBOARD – SEÇÕES E LISTAS
   ========================================================= */

.dashboard-section {
    margin-bottom: 28px;
}

.dashboard-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.dashboard-section-title {
    margin: 0;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #6b7280;
}

.dashboard-section-subtitle {
    margin: 4px 0 0;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.cards-grid--secondary {
    margin-top: 12px;
}

.cards-grid--two-columns {
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

/* submétricas dentro dos cards */
.stat-card-metrics {
    margin-top: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 0.78rem;
    color: var(--text-muted);
}

.stat-card-metrics--row {
    flex-wrap: nowrap;
}

.stat-metric {
    display: flex;
    flex-direction: column;
}

.stat-metric-label {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.stat-metric-value {
    font-size: 0.9rem;
    font-weight: 600;
    color: #111827;
}

.stat-metric-value--positive {
    color: #16a34a;
}

.stat-metric-value--negative {
    color: #b91c1c;
}

/* links discretos em microtexto */
.link-inline {
    font-size: 0.78rem;
    color: var(--accent);
    text-decoration: none;
}

.link-inline:hover {
    text-decoration: underline;
}

/* cards de lista / pendências */
.card-list {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-soft);
    box-shadow: var(--shadow-card-soft);
    padding: 14px 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.card-list--wide {
    margin-top: 6px;
}

.card-list-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-list-title {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 600;
    color: #111827;
}

.card-list-group {
    margin-top: 4px;
    padding-top: 6px;
    border-top: 1px dashed var(--border-soft);
}

.card-list-group-title {
    font-size: 0.78rem;
    font-weight: 600;
    color: #4b5563;
    margin-bottom: 2px;
}

.card-list-empty {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* item de pendência (vamos usar depois quando ligar no banco) */
.card-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    padding-top: 4px;
}

.card-list-item-main {
    display: flex;
    flex-direction: column;
}

.card-list-item-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* badge simples para futuros status */
.badge-pill {
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 500;
    border: 1px solid var(--border-soft);
    background: #f9fafb;
    color: #4b5563;
}

.badge-pill--danger {
    border-color: #fecaca;
    background: #fef2f2;
    color: #b91c1c;
}

.badge-pill--warning {
    border-color: #fed7aa;
    background: #fff7ed;
    color: #c2410c;
}

/* rodapé geral inferior */
.app-footer {
    border-top: 1px solid var(--border-soft);
    padding: 10px 28px 12px;
    font-size: 0.75rem;
    color: #9ca3af;
    display: flex;
    justify-content: space-between;
    background: #ffffff;
}

/* =========================================================
   RESPONSIVO PAINEL
   ========================================================= */

@media (max-width: 1024px) {
    .sidebar,
    .app-sidebar {
        width: 220px;
    }
}

@media (max-width: 768px) {

    .app-shell {
        position: relative;
    }

    /* sidebar vira off-canvas à esquerda */
    .sidebar,
    .app-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: 260px;
        max-width: 80%;
        flex-direction: column;
        overflow-y: auto;
        box-shadow: 0 0 40px rgba(15, 23, 42, 0.55);
        transform: translateX(-100%);
        transition: transform 0.25s ease-out;
        z-index: 40;
    }

    /* quando body tiver .sidebar-open, o menu aparece */
    body.sidebar-open .app-sidebar {
        transform: translateX(0);
    }

    /* backdrop escuro atrás do menu */
    .sidebar-backdrop {
        position: fixed;
        inset: 0;
        background: rgba(15, 23, 42, 0.55);
        z-index: 30;
        display: none;
    }

    body.sidebar-open .sidebar-backdrop {
        display: block;
    }

    /* escondemos o rodapé da sidebar no mobile */
    .sidebar-footer {
        display: none;
    }

    /* topbar mais compacta e com botão de menu */
    .app-topbar {
        padding: 10px 16px;
    }

    .btn-menu-toggle {
        display: flex;
    }

    .page-content,
    .app-content {
        padding: 16px 14px 18px;
    }

    .cards-grid {
        grid-template-columns: 1fr;
    }

    /* chip de usuário mais enxuto */
    .topbar-user-chip {
        background: transparent;
        padding: 0;
    }

    .topbar-right {
        gap: 8px;
    }
}

