/* ══════════════════════════════════════════════════════════════
   TOPBAR — Diseño moderno refinado
══════════════════════════════════════════════════════════════ */

/* ── Shell ─────────────────────────────────────────────────── */
.topbar {
    position: fixed;
    top: 0; right: 0;
    left: var(--sidebar-w, 268px);
    height: 62px;
    background: rgba(255,255,255,0.88);
    backdrop-filter: blur(28px) saturate(2);
    -webkit-backdrop-filter: blur(28px) saturate(2);
    border-bottom: 1px solid rgba(29,56,96,.08);
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: 0 1.5rem;
    z-index: 150;
    transition: left .3s cubic-bezier(.16,1,.3,1);
}
.topbar.shifted { left: 68px; }

/* ── Hamburger ─────────────────────────────────────────────── */
.toggle-btn {
    width: 36px; height: 36px;
    display: flex; align-items: center; justify-content: center;
    background: none; border: none; cursor: pointer;
    border-radius: 9px; color: var(--navy, #1D3860);
    font-size: 1.15rem;
    transition: background .15s;
    flex-shrink: 0;
}
.toggle-btn:hover { background: rgba(29,56,96,.07); }

/* ── Title ─────────────────────────────────────────────────── */
.topbar-title {
    font-size: .95rem;
    font-weight: 700;
    font-style: italic;
    color: var(--navy, #0d1a2e);
    letter-spacing: -.02em;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Org badge ─────────────────────────────────────────────── */
.tb-org-badge {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .3rem .75rem .3rem .55rem;
    border-radius: 10px;
    max-width: 360px;
    overflow: hidden;
    flex-shrink: 1;
    min-width: 0;
    border: 1px solid transparent;
}
.tb-org-badge.verified {
    background: rgba(16,185,129,.07);
    border-color: rgba(16,185,129,.18);
}
.tb-org-badge.unverified {
    background: rgba(245,158,11,.07);
    border-color: rgba(245,158,11,.2);
}
.tb-org-badge .tb-org-icon {
    font-size: .88rem; flex-shrink: 0;
    color: var(--slate, #475569);
}
.tb-org-meta {
    display: flex; flex-direction: column;
    overflow: hidden; min-width: 0;
}
.tb-org-badge .tb-org-name {
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    font-weight: 700; color: var(--navy, #1D3860); font-size: .78rem;
    line-height: 1.2;
}
.tb-org-badge .tb-org-sector {
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    font-size: .67rem; color: var(--muted, #64748b); line-height: 1.2;
}
.tb-org-badge .tb-org-status {
    display: flex; align-items: center; gap: .2rem;
    font-size: .7rem; font-weight: 700; flex-shrink: 0; white-space: nowrap;
}
.tb-org-badge.verified  .tb-org-status { color: #059669; }
.tb-org-badge.unverified .tb-org-status { color: #b45309; }
.tb-org-badge .tb-org-link {
    display: inline-flex; align-items: center; gap: .2rem;
    color: #b45309; text-decoration: none; font-weight: 700;
    font-size: .7rem; flex-shrink: 0;
    padding: .15rem .4rem;
    border-radius: 5px;
    border: 1px solid rgba(245,158,11,.35);
    background: rgba(245,158,11,.08);
    transition: background .15s;
}
.tb-org-badge .tb-org-link:hover { background: rgba(245,158,11,.18); }

/* ── Right actions ─────────────────────────────────────────── */
.topbar-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: .35rem;
    flex-shrink: 0;
}

/* ── Icon buttons ──────────────────────────────────────────── */
.topbar-btn {
    width: 36px; height: 36px;
    display: flex; align-items: center; justify-content: center;
    background: none; border: none; cursor: pointer;
    border-radius: 10px; color: var(--slate, #475569);
    font-size: 1rem; position: relative;
    transition: background .15s, color .15s;
}
.topbar-btn:hover { background: rgba(29,56,96,.07); color: var(--navy, #1D3860); }

.notif-dot {
    position: absolute;
    top: 5px; right: 5px;
    min-width: 16px; height: 16px;
    border-radius: 9px;
    background: #ef4444;
    border: 1.5px solid #fff;
    font-size: .6rem; font-weight: 700; color: #fff;
    display: flex; align-items: center; justify-content: center;
    padding: 0 3px; line-height: 1;
    pointer-events: none;
}

.notif-item {
    display: flex; align-items: flex-start; gap: .65rem;
    padding: .7rem 1rem;
    border-bottom: 1px solid rgba(0,0,0,.04);
    position: relative; transition: background .12s;
}
.notif-item:last-child { border-bottom: none; }
.notif-item.unread { background: rgba(37,99,235,.03); }
.notif-item:hover  { background: #f8fafc; }

.notif-icon {
    width: 30px; height: 30px; border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-size: .82rem; flex-shrink: 0; margin-top: .1rem;
}
.notif-icon.issued   { background: rgba(37,99,235,.1);  color: var(--blue,#2563eb); }
.notif-icon.accepted { background: rgba(21,128,61,.1);  color: #15803d; }
.notif-icon.revoked  { background: rgba(220,38,38,.1);  color: #dc2626; }
.notif-icon.default  { background: rgba(90,116,144,.1); color: var(--slate,#5a7490); }

.notif-content { flex: 1; min-width: 0; }
.notif-title {
    font-size: .78rem; font-weight: 700; color: var(--navy,#0d1a2e);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    margin-bottom: .1rem;
}
.notif-msg {
    font-size: .71rem; color: var(--muted,#5a7490); line-height: 1.35;
    overflow: hidden; display: -webkit-box;
    -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.notif-time { font-size: .63rem; color: var(--muted,#5a7490); margin-top: .2rem; }

.notif-del {
    width: 22px; height: 22px; border: none; background: none;
    border-radius: 5px; cursor: pointer; color: var(--muted,#5a7490);
    font-size: .72rem; display: flex; align-items: center;
    justify-content: center; flex-shrink: 0;
    opacity: 0; transition: opacity .15s, background .15s;
}
.notif-item:hover .notif-del { opacity: 1; }
.notif-del:hover { background: #fee2e2; color: #ef4444; }

.notif-hdr-btn {
    background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.18);
    color: rgba(255,255,255,.8); font-size: .65rem; font-weight: 600;
    padding: .18rem .48rem; border-radius: 5px; cursor: pointer;
    transition: background .15s; white-space: nowrap; line-height: 1.4;
}
.notif-hdr-btn:hover { background: rgba(255,255,255,.22); }
.notif-hdr-btn.danger { border-color: rgba(239,68,68,.35); color: rgba(252,165,165,.9); }
.notif-hdr-btn.danger:hover { background: rgba(239,68,68,.2); }

/* ── Avatar button ─────────────────────────────────────────── */
.topbar-avatar-btn {
    display: flex; align-items: center; gap: .5rem;
    background: none; border: none; cursor: pointer;
    padding: .25rem .5rem .25rem .25rem;
    border-radius: 10px;
    transition: background .15s;
}
.topbar-avatar-btn:hover { background: rgba(29,56,96,.07); }
.topbar-avatar-ring {
    width: 34px; height: 34px;
    border-radius: 9px;
    background: #0d1a2e;
    display: flex; align-items: center; justify-content: center;
    font-size: .78rem; font-weight: 700; color: #fff;
    overflow: hidden; flex-shrink: 0;
    border: 1px solid rgba(255,255,255,0.08);
    box-shadow: 0 1px 4px rgba(13,26,46,0.25);
}
.topbar-avatar-ring img {
    width: 100%; height: 100%; object-fit: cover; display: block;
}
.topbar-avatar-meta { display: flex; flex-direction: column; text-align: left; }
.topbar-avatar-name {
    font-size: .78rem; font-weight: 600; color: var(--navy, #1D3860);
    line-height: 1.1; white-space: nowrap;
}
.topbar-avatar-role {
    font-size: .67rem; color: var(--muted, #64748b);
    line-height: 1.1; white-space: nowrap;
}

/* ── Divider ───────────────────────────────────────────────── */
.tb-divider {
    width: 1px; height: 22px;
    background: rgba(29,56,96,.1);
    flex-shrink: 0;
}

/* ── Dropdown panels ───────────────────────────────────────── */
.topbar-dropdown-panel {
    display: none;
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    z-index: 1050;
    background: rgba(255,255,255,0.94);
    backdrop-filter: blur(28px) saturate(2);
    -webkit-backdrop-filter: blur(28px) saturate(2);
    border: 1px solid rgba(255,255,255,0.9);
    border-radius: 16px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.06), 0 24px 64px rgba(0,0,0,0.12), inset 0 1px 0 rgba(255,255,255,1);
    min-width: 230px;
    overflow: hidden;
    animation: dropIn .18s cubic-bezier(.16,1,.3,1);
}
.topbar-dropdown-panel.open { display: block; }
@keyframes dropIn { from { opacity:0; transform:translateY(-6px) scale(.98); } to { opacity:1; transform:translateY(0) scale(1); } }
.topbar-dropdown-panel.notif-panel { min-width: 300px; max-width: 340px; }

.dp-header {
    padding: .85rem 1.1rem .8rem;
    background: #0d1a2e;
    color: #fff;
    position: relative;
    overflow: hidden;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}
.dp-header .dp-name   { font-weight: 700; font-size: .9rem; line-height: 1.2; }
.dp-header .dp-role   { font-size: .7rem; opacity: .7; margin-top: .15rem; }

.dp-body { padding: .35rem 0; }

.dp-item {
    display: flex; align-items: center; gap: .65rem;
    padding: .6rem 1.1rem; font-size: .83rem; color: var(--text, #374151);
    text-decoration: none; cursor: pointer; transition: background .12s;
    border: none; background: none; width: 100%; text-align: left;
}
.dp-item:hover { background: #f8fafc; }
.dp-item i { width: 16px; text-align: center; color: var(--muted, #64748b); flex-shrink: 0; }
.dp-item.danger     { color: #ef4444; }
.dp-item.danger i   { color: #ef4444; }
.dp-item.danger:hover { background: #fff1f1; }
.dp-divider { height: 1px; background: #f1f5f9; margin: .2rem 0; }

.notif-empty {
    padding: 2rem 1rem; text-align: center;
    color: var(--muted, #64748b); font-size: .82rem;
}
.notif-empty i { font-size: 1.8rem; display: block; margin-bottom: .6rem; opacity: .3; }

/* ── Mobile ────────────────────────────────────────────────── */
@media (max-width: 991px) {
    .topbar { left: 0 !important; padding: 0 1rem; }
    .tb-org-badge .tb-org-name,
    .tb-org-badge .tb-org-status { display: none; }
    .topbar-avatar-meta { display: none; }
}
@media (max-width: 576px) {
    .topbar-title { font-size: .88rem; }
}
