* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Segoe UI', system-ui, sans-serif;
    background: #060910;
    color: #f1f5f9;
    min-height: 100vh;
}

/* ── Access Denied ── */
.access-denied {
    max-width: 440px;
    margin: 120px auto;
    text-align: center;
    background: rgba(16, 22, 36, 0.95);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 20px;
    padding: 48px 32px;
}
.access-denied i { font-size: 3rem; color: #ef4444; margin-bottom: 16px; }
.access-denied p { color: #94a3b8; margin: 10px 0 24px; }

/* ── Layout ── */
.staff-app {
    display: grid;
    grid-template-columns: 240px 1fr;
    min-height: 100vh;
}

.sidebar {
    background: rgba(10, 14, 24, 0.98);
    border-right: 1px solid rgba(255,255,255,0.06);
    display: flex;
    flex-direction: column;
    padding: 20px 0;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 20px 24px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    margin-bottom: 12px;
}
.sidebar-brand i { font-size: 1.6rem; color: #dc2626; }
.sidebar-brand strong { display: block; font-size: 0.95rem; }
.sidebar-brand small { color: #64748b; font-size: 0.72rem; word-break: break-all; }

.sidebar-nav { flex: 1; display: flex; flex-direction: column; gap: 2px; padding: 0 10px; }

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border: none;
    background: transparent;
    color: #94a3b8;
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: 10px;
    cursor: pointer;
    text-align: left;
    transition: 0.2s;
    width: 100%;
}
.nav-item i { width: 18px; text-align: center; }
.nav-item:hover { background: rgba(255,255,255,0.05); color: #e2e8f0; }
.nav-item.active { background: rgba(37,99,235,0.18); color: #60a5fa; }

.nav-badge {
    margin-left: auto;
    background: rgba(255,255,255,0.08);
    color: #94a3b8;
    font-size: 0.68rem;
    font-weight: 800;
    padding: 2px 7px;
    border-radius: 10px;
}
.nav-badge.alert { background: rgba(239,68,68,0.25); color: #f87171; }

.sidebar-back {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    margin-top: auto;
    color: #64748b;
    text-decoration: none;
    font-size: 0.82rem;
    border-top: 1px solid rgba(255,255,255,0.06);
}
.sidebar-back:hover { color: #94a3b8; }

/* ── Main Panel ── */
.main-panel {
    padding: 24px 28px;
    overflow-y: auto;
    max-height: 100vh;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 22px;
}
.panel-header h1 { font-size: 1.55rem; font-weight: 800; }
.panel-header p { color: #64748b; font-size: 0.85rem; margin-top: 4px; }

.header-actions { display: flex; align-items: center; gap: 10px; }
.live-dot {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.78rem;
    color: #4ade80;
    font-weight: 700;
}
.live-dot i { font-size: 0.5rem; animation: pulse 2s infinite; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:0.3} }

.btn-ghost, .btn-primary, .btn-danger {
    padding: 9px 16px;
    border-radius: 9px;
    border: 1px solid rgba(255,255,255,0.1);
    background: rgba(255,255,255,0.05);
    color: #fff;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: 0.2s;
}
.btn-primary { background: #2563eb; border-color: #2563eb; }
.btn-primary:hover { background: #1d4ed8; }
.btn-danger { background: #dc2626; border-color: #dc2626; }
.btn-danger:hover { background: #b91c1c; }
.btn-ghost:hover { background: rgba(255,255,255,0.1); }
.btn-primary:disabled, .btn-danger:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Toast ── */
.toast {
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 0.85rem;
    margin-bottom: 16px;
    display: none;
}
.toast.success { background: rgba(34,197,94,0.15); color: #4ade80; border: 1px solid rgba(34,197,94,0.3); }
.toast.error { background: rgba(239,68,68,0.15); color: #f87171; border: 1px solid rgba(239,68,68,0.3); }

/* ── Sections ── */
.section { display: none; }
.section.active { display: block; }

/* ── Stats ── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}
.stat-card {
    background: rgba(16, 22, 36, 0.9);
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 14px;
    padding: 18px;
}
.stat-card p { color: #64748b; font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; }
.stat-card h2 { font-size: 1.8rem; font-weight: 800; margin-top: 6px; }
.stat-card.blue h2 { color: #3b82f6; }
.stat-card.amber h2 { color: #f59e0b; }
.stat-card.green h2 { color: #22c55e; }
.stat-card.purple h2 { color: #a855f7; }
.stat-card.cyan h2 { color: #06b6d4; }
.stat-card.red h2 { color: #ef4444; }

.grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 18px;
}

.card {
    background: rgba(16, 22, 36, 0.9);
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 14px;
    padding: 22px;
}
.card h3 {
    font-size: 0.95rem;
    margin-bottom: 16px;
    color: #e2e8f0;
    display: flex;
    align-items: center;
    gap: 8px;
}
.card h3 i { color: #3b82f6; }
.hint { color: #64748b; font-size: 0.8rem; margin-bottom: 14px; }

/* ── Forms ── */
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 0.78rem; color: #94a3b8; margin-bottom: 5px; font-weight: 600; }
.form-input, textarea.form-input {
    width: 100%;
    background: rgba(8, 11, 18, 0.9);
    border: 1px solid rgba(255,255,255,0.1);
    padding: 10px 13px;
    border-radius: 8px;
    color: #fff;
    font-size: 0.88rem;
    outline: none;
    resize: vertical;
}
.form-input:focus { border-color: #3b82f6; }

.toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 16px;
    align-items: center;
}
.toolbar .form-input { max-width: 260px; }

/* ── Tables ── */
.table-wrap {
    background: rgba(16, 22, 36, 0.9);
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 14px;
    overflow: hidden;
    overflow-x: auto;
}
.data-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.data-table th, .data-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    vertical-align: top;
}
.data-table th {
    background: rgba(255,255,255,0.03);
    color: #64748b;
    font-size: 0.72rem;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.04em;
}
.data-table tr:hover td { background: rgba(255,255,255,0.02); }

.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 800;
}
.badge.Pending, .badge.open { background: rgba(245,158,11,0.2); color: #fbbf24; }
.badge.Approved, .badge.resolved, .badge.Completed { background: rgba(34,197,94,0.2); color: #4ade80; }
.badge.Rejected, .badge.closed { background: rgba(239,68,68,0.2); color: #f87171; }
.badge.in_progress { background: rgba(59,130,246,0.2); color: #60a5fa; }

.btn-sm {
    padding: 5px 11px;
    border-radius: 6px;
    border: none;
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    margin-right: 4px;
}
.btn-sm.approve { background: #22c55e; color: #fff; }
.btn-sm.reject { background: #ef4444; color: #fff; }
.btn-sm.view { background: rgba(59,130,246,0.2); color: #60a5fa; }
.btn-sm.supreme { background: #7f1d1d; color: #fecaca; border: 1px solid rgba(239,68,68,0.5); }
.btn-sm.supreme:hover { background: #991b1b; color: #fff; }

/* ── Payment Summary ── */
.payment-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}
.pay-stat {
    background: rgba(16, 22, 36, 0.9);
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 12px;
    padding: 16px;
}
.pay-stat span { display: block; color: #64748b; font-size: 0.78rem; margin-bottom: 4px; }
.pay-stat strong { font-size: 1.3rem; color: #22c55e; }

/* ── Support Chat ── */
.support-layout {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 0;
    background: rgba(16, 22, 36, 0.9);
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 14px;
    overflow: hidden;
    min-height: 560px;
}

.support-inbox {
    border-right: 1px solid rgba(255,255,255,0.06);
    display: flex;
    flex-direction: column;
}
.inbox-header {
    padding: 16px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.inbox-header h3 { font-size: 0.9rem; }

.inbox-list { flex: 1; overflow-y: auto; max-height: 480px; }

.inbox-item {
    padding: 14px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    cursor: pointer;
    transition: 0.2s;
    position: relative;
}
.inbox-item:hover, .inbox-item.active { background: rgba(37,99,235,0.12); }
.inbox-item.unread { border-left: 3px solid #3b82f6; }
.inbox-item .subj { font-weight: 700; font-size: 0.85rem; margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.inbox-item .meta { font-size: 0.72rem; color: #64748b; }
.inbox-item .unread-dot {
    position: absolute;
    top: 14px;
    right: 12px;
    width: 8px;
    height: 8px;
    background: #ef4444;
    border-radius: 50%;
}

.support-chat { display: flex; flex-direction: column; min-height: 560px; }

.support-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #64748b;
    gap: 12px;
    padding: 40px;
}
.support-empty i { font-size: 2.5rem; color: #334155; }

#supportActive { display: none; flex: 1; flex-direction: column; }

.chat-top {
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 10px;
}
.chat-meta { font-size: 0.78rem; color: #64748b; margin-top: 4px; }
.chat-top-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.chat-top-actions .form-input { width: auto; min-width: 130px; font-size: 0.8rem; padding: 7px 10px; }

.ticket-status-bar {
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
    padding: 10px 20px; border-bottom: 1px solid rgba(255,255,255,0.06);
    background: rgba(8,11,18,0.4);
}
.ticket-status-bar .status-label { font-size: 0.78rem; color: #64748b; margin-right: 4px; }
.status-btn {
    padding: 6px 12px; border-radius: 8px; border: 1px solid rgba(255,255,255,0.1);
    background: rgba(255,255,255,0.04); color: #e2e8f0; font-size: 0.78rem; font-weight: 700;
    cursor: pointer; display: inline-flex; align-items: center; gap: 6px; transition: 0.2s;
}
.status-btn:hover { background: rgba(255,255,255,0.1); }
.status-btn.active { box-shadow: 0 0 0 2px rgba(59,130,246,0.4); }
.status-btn.in_progress.active { background: rgba(59,130,246,0.2); border-color: rgba(59,130,246,0.4); color: #60a5fa; }
.status-btn.resolved.active { background: rgba(34,197,94,0.15); border-color: rgba(34,197,94,0.35); color: #4ade80; }
.status-btn.closed.active { background: rgba(239,68,68,0.15); border-color: rgba(239,68,68,0.35); color: #f87171; }
.ticket-closed-banner {
    padding: 10px 20px; background: rgba(239,68,68,0.12); border-bottom: 1px solid rgba(239,68,68,0.25);
    color: #f87171; font-size: 0.82rem; font-weight: 600;
}

.chat-msg.system {
    align-self: center; max-width: 90%; background: rgba(245,158,11,0.1);
    border: 1px solid rgba(245,158,11,0.25); color: #fbbf24; font-size: 0.8rem; text-align: center;
}

.chat-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 380px;
    min-height: 300px;
}

.chat-msg {
    max-width: 78%;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 0.86rem;
    line-height: 1.5;
}
.chat-msg.client { align-self: flex-start; background: rgba(37,99,235,0.12); border: 1px solid rgba(37,99,235,0.2); }
.chat-msg.staff { align-self: flex-end; background: rgba(34,197,94,0.1); border: 1px solid rgba(34,197,94,0.2); }
.chat-msg .who { font-size: 0.7rem; color: #94a3b8; font-weight: 700; margin-bottom: 4px; }
.chat-msg .when { font-size: 0.68rem; color: #64748b; margin-top: 4px; }

.chat-reply {
    padding: 14px 20px;
    border-top: 1px solid rgba(255,255,255,0.06);
    display: flex;
    gap: 10px;
}
.chat-reply .form-input { flex: 1; }

/* ── Activity Feed ── */
.activity-feed { display: flex; flex-direction: column; gap: 10px; max-height: 320px; overflow-y: auto; }
.activity-item {
    display: flex;
    gap: 12px;
    padding: 10px 12px;
    background: rgba(8,11,18,0.6);
    border-radius: 10px;
    font-size: 0.82rem;
}
.activity-item i { color: #3b82f6; margin-top: 2px; }
.activity-item .act-time { color: #64748b; font-size: 0.72rem; margin-top: 3px; }

/* ── Quick Actions ── */
.quick-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.qa-btn {
    padding: 14px;
    background: rgba(8,11,18,0.7);
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 10px;
    color: #e2e8f0;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: 0.2s;
    text-align: left;
}
.qa-btn:hover { background: rgba(37,99,235,0.12); border-color: rgba(37,99,235,0.3); }
.qa-btn i { color: #3b82f6; }

/* ── Staff List ── */
.staff-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: rgba(8,11,18,0.6);
    border-radius: 8px;
    margin-bottom: 8px;
    font-size: 0.85rem;
}
.staff-item button { background: none; border: none; color: #f87171; cursor: pointer; }

/* ── Announcements ── */
.announce-item {
    padding: 12px 14px;
    background: rgba(8,11,18,0.6);
    border-radius: 10px;
    margin-bottom: 10px;
    border-left: 3px solid #3b82f6;
}
.announce-item.warning { border-left-color: #f59e0b; }
.announce-item.maintenance { border-left-color: #ef4444; }
.announce-item h4 { font-size: 0.88rem; margin-bottom: 4px; }
.announce-item p { color: #94a3b8; font-size: 0.82rem; }
.announce-item .ann-meta { font-size: 0.72rem; color: #64748b; margin-top: 6px; display: flex; justify-content: space-between; align-items: center; }

/* ── Client row clickable ── */
.client-row { cursor: pointer; }
.client-row:hover td { background: rgba(37,99,235,0.08) !important; }

.modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.75); backdrop-filter: blur(6px);
    display: flex; align-items: center; justify-content: center; z-index: 9999; padding: 20px;
}
.modal-card {
    background: #101624; border: 1px solid rgba(255,255,255,0.1); border-radius: 16px;
    padding: 24px; width: 100%; max-width: 480px;
}
.modal-card h3 { font-size: 1.1rem; margin-bottom: 4px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; }

/* ── Payment Methods (Gateways) ── */
.badge.Paid { background: rgba(34,197,94,0.25); color: #4ade80; }
.gateway-list { display: flex; flex-direction: column; gap: 12px; }
.gateway-card {
    display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
    background: rgba(16, 22, 36, 0.9); border: 1px solid rgba(255,255,255,0.07);
    border-radius: 14px; padding: 16px;
}
.gateway-card.disabled { opacity: 0.55; }
.gw-icon {
    width: 46px; height: 46px; border-radius: 12px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center; font-size: 1.25rem;
}
.gw-main { flex: 1 1 260px; min-width: 220px; }
.gw-main strong { font-size: 1rem; color: #f8fafc; }
.gw-slug { font-size: 0.75rem; color: #64748b; margin-bottom: 6px; }
.gw-fields { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.gw-field-tag {
    background: rgba(59,130,246,0.12); border: 1px solid rgba(59,130,246,0.25);
    color: #93c5fd; font-size: 0.72rem; border-radius: 8px; padding: 2px 8px;
}
.gw-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.gw-field-row {
    display: grid; grid-template-columns: 1fr 130px 1fr 34px; gap: 8px;
    align-items: center; margin-bottom: 8px;
}
.gw-remove-btn {
    width: 34px; height: 34px; border-radius: 8px; border: none; cursor: pointer;
    background: rgba(239,68,68,0.15); color: #f87171; font-size: 0.9rem;
}

@media (max-width: 900px) {
    .gw-field-row { grid-template-columns: 1fr; }
    .gw-remove-btn { width: 100%; height: 34px; }
}

@media (max-width: 900px) {
    .staff-app { grid-template-columns: 1fr; }
    .sidebar {
        position: relative;
        height: auto;
        flex-direction: row;
        flex-wrap: wrap;
        padding: 12px;
    }
    .sidebar-nav { flex-direction: row; flex-wrap: wrap; }
    .sidebar-back { display: none; }
    .support-layout { grid-template-columns: 1fr; }
    .support-inbox { border-right: none; border-bottom: 1px solid rgba(255,255,255,0.06); }
    .inbox-list { max-height: 200px; }
}
