:root {
    --sidebar-w: 240px;
    --topbar-h: 56px;
    --brand-red: #c8102e;
    --muted-bg: #f5f5f7;
}

* { -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body {
    background: var(--muted-bg);
    overflow-x: hidden;
}

/* ==================== LAYOUT ==================== */
.layout { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w);
    background: #fff;
    border-right: 1px solid #e5e5e7;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    display: flex; flex-direction: column;
    z-index: 1040;
    transition: transform 0.25s ease;
}
.sidebar-header {
    padding: 1rem;
    border-bottom: 1px solid #e5e5e7;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-height: var(--topbar-h);
}
.sidebar-logo {
    height: 42px;
    width: auto;
    flex-shrink: 0;
}
.sidebar-nav { padding: 0.5rem; flex: 1; overflow-y: auto; }
.sidebar-nav .nav-link {
    display: flex; align-items: center; gap: 0.6rem;
    padding: 0.75rem 0.75rem;        /* mais alto para touch */
    color: #444; border-radius: 6px;
    text-decoration: none; font-size: 0.95rem;
    min-height: 44px;                /* touch target */
}
.sidebar-nav .nav-link:hover,
.sidebar-nav .nav-link:focus { background: #f0f0f2; color: #000; }
.sidebar-nav .nav-link.disabled { color: #aaa; pointer-events: none; }
.sidebar-nav .nav-link i { width: 18px; text-align: center; font-size: 1.05rem; }

.main {
    margin-left: var(--sidebar-w);
    flex: 1;
    min-width: 0;
}

.topbar {
    height: var(--topbar-h);
    background: #fff;
    border-bottom: 1px solid #e5e5e7;
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 1rem;
    position: sticky; top: 0; z-index: 20;
    gap: 0.5rem;
}
.topbar-title {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.btn-burger {
    background: transparent;
    border: 0;
    padding: 0.5rem;
    font-size: 1.5rem;
    line-height: 1;
    color: #333;
    display: none;        /* só aparece em mobile */
    min-width: 44px;
    min-height: 44px;
}
.user-area {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}
.user-name {
    color: #6c757d;
    font-size: 0.85rem;
}

.content { padding: 1.5rem; }

/* Backdrop quando sidebar abre em mobile */
.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 1030;
}
.sidebar-backdrop.show { display: block; }

/* ==================== CARDS / TABELAS ==================== */
.card { border: 1px solid #e5e5e7; box-shadow: none; }
.card-header { background: #fafafb; font-size: 0.9rem; }

.table > :not(caption) > * > * { padding: 0.65rem 0.75rem; }

/* ==================== FORMULÁRIOS (touch friendly) ==================== */
.form-control,
.form-select {
    min-height: 44px;
    font-size: 1rem;     /* evita zoom no iOS */
}
.form-control-sm,
.form-select-sm {
    min-height: 36px;
    font-size: 0.875rem;
}
.btn {
    min-height: 38px;
}
.btn-sm {
    min-height: 32px;
}
.form-check-input {
    width: 1.15em;
    height: 1.15em;
    margin-top: 0.2em;
}

/* ==================== LOGIN ==================== */
.auth-body {
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    background: var(--muted-bg);
    background-image:
        radial-gradient(circle at 20% 10%, rgba(200,16,46,0.06), transparent 40%),
        radial-gradient(circle at 80% 90%, rgba(0,0,0,0.04), transparent 40%);
    padding: 1rem;
}
.auth-card {
    width: 100%;
    max-width: 420px;
    padding: 2rem 1.75rem;
    background: #fff;
    border-radius: 10px;
    border: 1px solid #e5e5e7;
    box-shadow: 0 2px 12px rgba(0,0,0,0.04);
}
.auth-logo {
    max-width: 240px;
    width: 100%;
    height: auto;
}

/* ==================== HELPERS ==================== */
dl.row dt { font-weight: 500; }
.badge { font-weight: 500; }

.btn-brand {
    background: var(--brand-red);
    color: #fff;
    border-color: var(--brand-red);
}
.btn-brand:hover {
    background: #a30d24;
    color: #fff;
    border-color: #a30d24;
}

/* Lista de sócios — versão card em mobile */
.socios-table { display: table; width: 100%; }
.socio-card { display: none; }

/* ==================== TABLET ==================== */
@media (max-width: 991.98px) {
    .user-name { display: none; }
}

/* ==================== MOBILE ==================== */
@media (max-width: 767.98px) {
    /* Sidebar fica oculta e abre por cima */
    .sidebar {
        transform: translateX(-100%);
        box-shadow: 2px 0 8px rgba(0,0,0,0.12);
    }
    .sidebar.show { transform: translateX(0); }

    .main { margin-left: 0; }

    .btn-burger { display: inline-flex; align-items: center; justify-content: center; }

    .content { padding: 1rem; }

    .topbar h1.h5 { font-size: 1rem; }

    /* Tabela de sócios → cards */
    .socios-table thead { display: none; }
    .socios-table,
    .socios-table tbody,
    .socios-table tr,
    .socios-table td { display: block; width: 100%; }
    .socios-table tr {
        border: 1px solid #e5e5e7;
        border-radius: 8px;
        margin-bottom: 0.75rem;
        padding: 0.75rem;
        background: #fff;
    }
    .socios-table td {
        padding: 0.25rem 0;
        border: 0;
    }
    .socios-table td::before {
        content: attr(data-label);
        font-weight: 500;
        color: #6c757d;
        display: inline-block;
        min-width: 90px;
        font-size: 0.85rem;
    }
    .socios-table td[data-label="Nome"] {
        font-size: 1.05rem;
        font-weight: 500;
        padding-bottom: 0.5rem;
        margin-bottom: 0.5rem;
        border-bottom: 1px solid #f0f0f2;
    }
    .socios-table td[data-label="Nome"]::before { display: none; }
    .socios-table td[data-label=""] { text-align: right; padding-top: 0.5rem; }
    .socios-table td[data-label=""]::before { display: none; }

    /* Header da listagem empilhado */
    .listagem-toolbar {
        flex-direction: column;
        align-items: stretch !important;
        gap: 0.75rem !important;
    }
    .listagem-toolbar form {
        flex-wrap: wrap;
    }
    .listagem-toolbar form > * { flex: 1 1 100%; }
    .listagem-toolbar form button { flex: 0 0 auto; }

    /* Botões em coluna no detalhe */
    .acoes-detalhe {
        flex-wrap: wrap;
    }

    /* Tabs com scroll horizontal */
    .nav-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .nav-tabs .nav-link { white-space: nowrap; }
}

/* ==================== MOBILE PEQUENO ==================== */
@media (max-width: 380px) {
    .sidebar-header strong { font-size: 0.95rem; }
    .topbar { padding: 0 0.5rem; }
}
