/* GesCredi — shared layout */
:root {
    --sidebar-w: 260px;
    --topbar-h: 60px;
    --bottomnav-h: 64px;
}
body { background: var(--bg-gradient); color: var(--text); }

/* ============ SIDEBAR ============ */
.sidebar {
    position: fixed; top: 0; left: 0;
    width: var(--sidebar-w); height: 100vh;
    background: var(--sidebar-bg);
    border-right: none;
    display: flex; flex-direction: column;
    z-index: 100;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
}
.sidebar-brand {
    height: var(--topbar-h);
    padding: 0 22px;
    font-size: 22px; font-weight: 800; letter-spacing: -0.6px;
    color: var(--text);
    display: flex; align-items: center; justify-content: space-between;
    flex-shrink: 0;
    border-bottom: 1px solid var(--border);
}
.sidebar-brand .brand-text { display: inline-flex; align-items: center; gap: 8px; }
.brand-name > span { color: var(--primary); }
.brand-logo { height: 26px; width: auto; }
.brand-logo-topbar { height: 22px; width: auto; filter: brightness(0) invert(1); }
.sidebar-close {
    background: none; border: none;
    color: var(--text-muted); font-size: 22px;
    cursor: pointer; padding: 4px 6px; border-radius: 8px;
}
.sidebar-close:hover { background: var(--surface-hover); color: var(--text); }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 8px 12px 24px; }
.nav-section-label {
    font-size: 10.5px; font-weight: 700;
    color: var(--text-faint);
    text-transform: uppercase; letter-spacing: 1px;
    padding: 16px 10px 6px;
}
.nav-link {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 12px; margin: 1px 0;
    border-radius: var(--radius-sm);
    color: var(--text-muted); text-decoration: none;
    font-size: 14px; font-weight: 500;
    transition: all 0.15s ease;
}
.nav-link i { font-size: 18px; width: 22px; text-align: center; }
.nav-link:hover { background: var(--surface-hover); color: var(--text); transform: translateX(3px); }
.nav-link.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.sidebar-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,0.5); z-index: 99;
}
.sidebar-overlay.active { display: block; }

/* ============ MAIN / TOPBAR ============ */
.main {
    flex: 1; min-width: 0; margin-left: 0;
    padding-top: calc(var(--topbar-h) + env(safe-area-inset-top));
    padding-bottom: calc(var(--bottomnav-h) + env(safe-area-inset-bottom));
}
.topbar {
    position: fixed; top: 0; left: 0; right: 0;
    height: calc(var(--topbar-h) + env(safe-area-inset-top));
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
    padding: env(safe-area-inset-top) 16px 0;
    gap: 12px; z-index: 90;
}
.topbar-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.btn-icon {
    width: 40px; height: 40px;
    display: inline-flex; align-items: center; justify-content: center;
    background: transparent; border: 1px solid transparent;
    border-radius: var(--radius-sm);
    color: var(--text-muted); cursor: pointer;
    font-size: 20px; transition: all 0.15s ease;
    text-decoration: none; position: relative;
}
.btn-icon:hover { background: var(--surface-hover); color: var(--text); }
.topbar-brand {
    display: inline-flex; align-items: center; gap: 7px;
    font-size: 18px; font-weight: 800; letter-spacing: -0.4px;
    color: var(--text); text-decoration: none;
}
.topbar-brand .brand-name > span { color: var(--primary); }
.topbar-right { display: flex; align-items: center; gap: 6px; }
.user-pill {
    display: none; align-items: center; gap: 10px;
    padding: 4px 12px 4px 4px; border-radius: 999px;
    background: var(--surface-2); border: 1px solid var(--border);
    color: var(--text); text-decoration: none;
    font-size: 13px; font-weight: 600;
}
.user-pill:hover { background: var(--surface-hover); }
.user-avatar {
    width: 32px; height: 32px; border-radius: 50%;
    background: var(--primary); color: #fff;
    display: inline-flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 13px;
}
.user-wrap { position: relative; }
.menu-pop {
    position: absolute; right: 0; top: calc(100% + 6px);
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow-lg);
    min-width: 220px; padding: 6px; z-index: 200;
    display: none;
}
.menu-pop.show { display: block; }
.menu-pop a {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px; border-radius: var(--radius-sm);
    color: var(--text); text-decoration: none;
    font-size: 13px; font-weight: 500;
}
.menu-pop a:hover { background: var(--surface-hover); }
.menu-pop a.danger { color: var(--danger); }
.menu-pop a.danger:hover { background: var(--danger-soft); }
.menu-pop hr { border: none; border-top: 1px solid var(--border-subtle); margin: 4px 0; }

/* ============ CONTENT ============ */
.container-page { padding: 16px; max-width: 1320px; margin: 0 auto; }
.page-head {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; margin-bottom: 16px; flex-wrap: wrap;
}
.page-head h1 {
    font-size: 22px; font-weight: 800; letter-spacing: -0.6px;
    color: var(--text); margin: 0 0 4px;
}
.page-head p { font-size: 13px; color: var(--text-muted); margin: 0; }
.btn-cta {
    display: inline-flex; align-items: center; gap: 8px;
    background: var(--primary); color: #fff;
    padding: 10px 16px; border-radius: var(--radius-sm);
    font-size: 13.5px; font-weight: 600; text-decoration: none;
    border: none; cursor: pointer;
    box-shadow: var(--primary-glow); transition: all 0.15s;
}
.btn-cta:hover { background: var(--primary-hover); color: #fff; transform: translateY(-1px); }
.btn-cta i { font-size: 16px; }
.btn-ghost {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 9px 16px; border: 1px solid var(--border); border-radius: var(--radius-sm);
    background: var(--surface); color: var(--text-muted);
    font-size: 13.5px; font-weight: 600; font-family: inherit;
    text-decoration: none; cursor: pointer; transition: all .15s;
}
.btn-ghost:hover { background: var(--surface-hover); color: var(--text); }

/* ============ SESSION ALERTS ============ */
.session-alert {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 12px 14px; border-radius: var(--radius-sm);
    font-size: 13.5px; font-weight: 500;
    margin-bottom: 14px; border: 1px solid transparent;
}
.session-alert i { font-size: 18px; flex-shrink: 0; margin-top: 1px; }
.session-alert .close {
    background: none; border: none; color: inherit;
    font-size: 18px; cursor: pointer; margin-left: auto; opacity: 0.6;
}
.session-alert .close:hover { opacity: 1; }
.session-alert.success { background: rgba(16,185,129,0.10); color: var(--accent-green); border-color: rgba(16,185,129,0.25); }
.session-alert.danger  { background: var(--danger-soft); color: var(--danger); border-color: rgba(239,68,68,0.25); }
.session-alert.warn    { background: rgba(245,158,11,0.10); color: var(--accent-orange); border-color: rgba(245,158,11,0.25); }

/* ============ STAT CARDS ============ */
.stats-grid {
    display: grid; grid-template-columns: 1fr 1fr;
    gap: 10px; margin-bottom: 14px;
}
.stat-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 14px 16px;
    box-shadow: var(--shadow-sm); transition: box-shadow 0.15s, transform 0.15s;
}
.stat-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.stat-top {
    display: flex; align-items: center; justify-content: space-between;
    gap: 8px; margin-bottom: 8px;
}
.stat-icon {
    width: 34px; height: 34px; border-radius: var(--radius-sm);
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 17px; color: #fff; flex-shrink: 0;
}
.stat-icon.green  { background: var(--accent-green); }
.stat-icon.blue   { background: var(--accent-blue); }
.stat-icon.orange { background: var(--accent-orange); }
.stat-icon.red    { background: var(--danger); }
.stat-label {
    font-size: 11px; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.6px; color: var(--text-muted);
}
.stat-value {
    font-size: 26px; font-weight: 800; color: var(--text);
    letter-spacing: -0.5px; line-height: 1.1; font-variant-numeric: tabular-nums;
}
.stat-sub {
    font-size: 12px; color: var(--text-muted); font-weight: 500;
    margin-top: 2px;
}

/* ============ ACTIVITY LINE ============ */
.activity-line {
    font-size: 12.5px; color: var(--text-muted);
    margin: 4px 2px 18px;
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.activity-line strong { color: var(--text); font-weight: 700; }
.activity-icon {
    width: 24px; height: 24px; border-radius: 6px;
    background: rgba(59,130,246,0.12);
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 13px; color: var(--accent-blue); flex-shrink: 0;
}

/* ============ LIST HEADER ============ */
.list-header {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 16px;
    background: var(--surface); border-bottom: 1px solid var(--border);
    border-radius: var(--radius) var(--radius) 0 0;
    flex-wrap: wrap;
}
.list-header-icon {
    width: 28px; height: 28px; border-radius: var(--radius-sm);
    background: rgba(59,130,246,0.12);
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 14px; color: var(--accent-blue); flex-shrink: 0;
}
.list-header span,
.list-header-title {
    font-size: 13px; font-weight: 700; color: var(--text); letter-spacing: 0.2px;
}

/* ============ EMPTY STATE ============ */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.empty-state i { font-size: 54px; color: var(--text-faint); display: block; margin-bottom: 12px; }
.empty-state h3 { font-size: 17px; font-weight: 700; color: var(--text); margin: 0 0 6px; }
.empty-state p { margin: 0 0 18px; font-size: 13.5px; }

/* ============ BOTTOM NAV ============ */
.bottom-nav {
    position: fixed; bottom: 0; left: 0; right: 0;
    height: var(--bottomnav-h);
    background: var(--surface); border-top: 1px solid var(--border);
    display: flex; z-index: 90;
    padding-bottom: env(safe-area-inset-bottom);
}
.bottom-nav a {
    flex: 1;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 2px; color: var(--text-muted); text-decoration: none;
    font-size: 10.5px; font-weight: 600; position: relative;
}
.bottom-nav a i { font-size: 20px; }
.bottom-nav a.active { color: var(--primary); }
.bottom-nav a.active::before {
    content: ''; position: absolute; top: 0; left: 24%; right: 24%;
    height: 3px; background: var(--primary); border-radius: 0 0 4px 4px;
}
.bottom-nav .fab { margin-top: -22px; }
.bottom-nav .fab a {
    width: 52px; height: 52px; background: var(--primary); color: #fff;
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
    font-size: 22px; box-shadow: var(--primary-glow);
}
.bottom-nav .fab a.active::before { display: none; }

/* ============ RESPONSIVE ============ */
@media (min-width: 600px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
    .container-page { padding: 24px; }
    .page-head h1 { font-size: 26px; }
}
@media (min-width: 900px) {
    .stats-grid { grid-template-columns: repeat(4, 1fr); gap: 14px; }
}
@media (max-width: 1023px) {
    .topbar { background: var(--primary); border-bottom-color: transparent; }
    .topbar .btn-icon { color: rgba(255,255,255,0.85); border-color: transparent; }
    .topbar .btn-icon:hover { background: rgba(255,255,255,0.18); color: #fff; }
    .topbar-brand { color: #fff; }
    .topbar-brand .brand-name > span { color: #fff; }
}
@media (min-width: 1024px) {
    :root { --topbar-h: 64px; }
    .sidebar { transform: translateX(0); }
    .sidebar-close { display: none; }
    .main { margin-left: var(--sidebar-w); padding-bottom: 24px; }
    .topbar { left: var(--sidebar-w); box-shadow: var(--shadow); }
    .btn-menu { display: none !important; }
    .bottom-nav { display: none; }
    .user-pill { display: inline-flex; }
    .topbar-brand { display: none; }
}
