/* ===================== Admin area ===================== */
.admin-shell { min-height: 100vh; background: var(--bg-alt); }
.admin-bar {
    display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
    padding: 10px 24px; background: #fff; border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20;
}
.admin-brand { display: flex; align-items: center; gap: 10px; color: var(--navy); font-size: 1.1rem; }
.admin-brand img { height: 40px; width: auto; }
.admin-brand small { font-weight: 600; color: var(--muted); font-size: .85rem; margin-left: 4px; }
.admin-user { display: flex; align-items: center; gap: 10px; font-size: .9rem; font-weight: 600; color: var(--navy); }
.admin-user form { margin: 0; }
.admin-main { padding: 24px; max-width: 1400px; margin: 0 auto; }

.admin-login { min-height: calc(100vh - 80px); display: flex; align-items: center; justify-content: center; }
.admin-login-card { width: 100%; max-width: 400px; padding: 32px; }
.admin-login-card h1 { font-size: 1.5rem; margin: 20px 0 4px; }
.admin-login-form { display: grid; gap: 14px; margin-top: 18px; }
.form-ok { color: var(--success); background: #e7f6ec; padding: 10px 14px; border-radius: 10px; font-size: .9rem; }
.form-ok.inline { padding: 4px 10px; align-self: center; }

.admin-tabs { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.admin-tab {
    font: inherit; font-weight: 700; padding: 10px 18px; border-radius: 10px; cursor: pointer;
    border: 1px solid var(--border); background: #fff; color: var(--navy); display: inline-flex; gap: 8px; align-items: center;
}
.admin-tab.is-active { background: var(--navy); color: #fff; border-color: var(--navy); }
.pill { font-size: .75rem; background: var(--soft); color: var(--primary); padding: 2px 8px; border-radius: 999px; }
.admin-tab.is-active .pill { background: rgba(255, 255, 255, .15); color: #fff; }
.pill-alert { background: #fff1e0; color: #c2410c; }

.status-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.status-chip {
    font: inherit; font-size: .85rem; font-weight: 600; padding: 6px 12px; border-radius: 999px; cursor: pointer;
    border: 1px solid var(--border); background: #fff; color: var(--text); display: inline-flex; gap: 6px;
}
.status-chip b { color: var(--muted); }
.status-chip.is-active { border-color: var(--primary); background: var(--soft); color: var(--primary); }

.admin-filters { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end; padding: 16px; margin-bottom: 16px; }
.admin-filters label { font-size: .8rem; min-width: 150px; }
.admin-filters label.grow { flex: 1 1 260px; }
.admin-filters input, .admin-filters select { padding: 8px 12px; }
.inline-check { min-width: auto !important; padding-bottom: 10px; }
.filter-actions { display: flex; gap: 8px; margin-left: auto; }

.admin-table-wrap { padding: 0; overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.admin-table th {
    text-align: left; font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted);
    background: var(--bg-alt); padding: 12px 14px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
.admin-table td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
.admin-table tr.is-open td { background: #f8fbf6; }
.admin-table tr.is-unread td { font-weight: 600; }
.admin-table tr.is-unread td:first-child { box-shadow: inset 3px 0 0 #f7941d; }
.admin-table .nowrap { white-space: nowrap; }
.admin-table .clip { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin-table .empty { text-align: center; color: var(--muted); padding: 40px; }
.detail-row td { background: #f8fbf6; }
.detail-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 24px; }
.detail-grid dl { display: grid; grid-template-columns: 130px 1fr; gap: 6px 12px; margin: 0; }
.detail-grid dt { font-weight: 600; color: var(--muted); }
.detail-grid dd { margin: 0; }
.pre { white-space: pre-wrap; }

.status-select { padding: 6px 10px !important; font-size: .85rem; font-weight: 600; border-radius: 999px !important; width: auto !important; }
.st-new { background: #fff1e0 !important; color: #c2410c; }
.st-contacted { background: #e7f0fb !important; color: #1d4f8a; }
.st-demo-scheduled { background: #f1ecfb !important; color: #5b2bb5; }
.st-proposal-sent { background: #e6f6f7 !important; color: #0e6670; }
.st-won { background: #e7f6ec !important; color: #15803d; }
.st-lost { background: #f1f2f3 !important; color: #5c6e66; }
.status-chip.st-new.is-active, .status-chip.st-won.is-active { border-color: currentColor; }

/* Notification bell */
.bell-wrap { position: relative; }
.bell {
    position: relative; display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px;
    border-radius: 10px; border: 1px solid var(--border); background: #fff; color: var(--navy); cursor: pointer;
}
.bell.has-items { color: #c2410c; border-color: #fbd3a8; background: #fff8f0; }
.bell.has-items svg { animation: bell-ring 2.4s ease-in-out infinite; transform-origin: 50% 10%; }
@keyframes bell-ring { 0%, 70%, 100% { transform: rotate(0); } 75% { transform: rotate(14deg); } 85% { transform: rotate(-12deg); } 92% { transform: rotate(6deg); } }
.bell-badge {
    position: absolute; top: -6px; right: -6px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 999px;
    background: #f7941d; color: #fff; font-size: .7rem; font-weight: 800; display: inline-flex; align-items: center; justify-content: center;
    border: 2px solid #fff;
}
.bell-panel {
    position: absolute; right: 0; top: 48px; width: 340px; max-width: calc(100vw - 32px); z-index: 50;
    background: #fff; border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-lg); overflow: hidden;
}
.bell-head { padding: 12px 14px; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 2px; font-size: .9rem; }
.bell-head .muted { font-weight: 500; font-size: .78rem; }
.bell-empty { padding: 20px 14px; margin: 0; color: var(--muted); text-align: center; font-weight: 500; }
.bell-item, .toast {
    display: flex; gap: 10px; align-items: flex-start; width: 100%; text-align: left; font: inherit; cursor: pointer;
    background: #fff; border: 0; border-bottom: 1px solid var(--border); padding: 12px 14px; color: var(--text);
}
.bell-item:hover { background: var(--bg-alt); }
.bell-dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 5px; flex-shrink: 0; background: #f7941d; }
.bell-dot.contact { background: var(--primary); }
.bell-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.bell-text b { font-size: .88rem; color: var(--navy); }
.bell-text small { font-size: .78rem; font-weight: 500; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Live pop-ups */
.toast-stack { position: fixed; right: 20px; bottom: 20px; z-index: 100; display: flex; flex-direction: column; gap: 10px; width: 340px; max-width: calc(100vw - 40px); }
.toast {
    border: 1px solid #fbd3a8; border-left: 4px solid #f7941d; border-radius: 12px; box-shadow: var(--shadow-lg);
    animation: toast-in .3s ease-out; position: relative; padding-right: 34px;
}
.toast-close { position: absolute; top: 6px; right: 10px; font-size: 1.2rem; color: var(--muted); line-height: 1; }
@keyframes toast-in { from { transform: translateY(16px); opacity: 0; } to { transform: none; opacity: 1; } }

.pager { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; font-size: .9rem; }
.pager .btn-row { margin: 0; }

@media (max-width: 800px) {
    .admin-main { padding: 14px; }
    .detail-grid { grid-template-columns: 1fr; }
    .filter-actions { margin-left: 0; width: 100%; }
}
