/*
 * RSD Finance Panel - User Dashboard Styles
 * RTL / Persian Design
 * Version: 1.0.0
 */

/* ============================================
   RESET & BASE
============================================ */
.rsd-fp-portal {
    direction: rtl;
    font-family: 'IRANSans', 'Tahoma', 'Arial', sans-serif;
    background: linear-gradient(135deg, #e0f2fe 0%, #ede9fe 50%, #fdf2f8 100%);
    background-attachment: fixed;
}

.rsd-fp-portal *,
.rsd-fp-portal *::before,
.rsd-fp-portal *::after {
    box-sizing: border-box;
}

.rsd-fp-portal h1,
.rsd-fp-portal h2,
.rsd-fp-portal h3,
.rsd-fp-portal h4,
.rsd-fp-portal h5,
.rsd-fp-portal h6 {
    margin: 0;
    line-height: 1.4;
    color: #1e293b;
}

.rsd-fp-portal p { margin: 0 0 12px; line-height: 1.6; }
.rsd-fp-portal a { color: #3b82f6; text-decoration: none; transition: .2s; }
.rsd-fp-portal a:hover { color: #1d4ed8; }

/* ============================================
   MAIN LAYOUT
============================================ */
.rsd-fp-wrapper {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

.rsd-fp-sidebar {
    width: 280px;
    min-width: 280px;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(10px);
    border-left: 1px solid rgba(226, 232, 240, 0.6);
    padding: 24px 0;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.rsd-fp-main {
    flex: 1;
    min-width: 0;
    padding: 20px 28px;
}

/* ============================================
   SIDEBAR
============================================ */
.rsd-fp-sidebar-header {
    padding: 0 24px 24px;
    text-align: center;
    border-bottom: 1px solid #f1f5f9;
    margin-bottom: 20px;
}

.rsd-fp-sidebar-header .rsd-fp-logo {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: linear-gradient(135deg, #3b82f6, #6366f1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 18px;
    margin-bottom: 12px;
    box-shadow: 0 4px 14px rgba(59, 130, 246, .35);
}

.rsd-fp-sidebar-header h3 {
    font-size: 16px;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 4px;
}

.rsd-fp-sidebar-header p {
    font-size: 12px;
    color: #64748b;
    margin: 0;
}

.rsd-fp-nav {
    flex: 1;
    padding: 0 14px;
}

.rsd-fp-nav-label {
    display: block;
    padding: 8px 10px;
    font-size: 11px;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: .5px;
    font-weight: 600;
    margin-top: 10px;
}

.rsd-fp-nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 10px;
    color: #475569;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 2px;
    cursor: pointer;
    transition: all .2s ease;
    text-decoration: none !important;
}

.rsd-fp-nav-item:hover {
    background: rgba(59, 130, 246, 0.08);
    color: #3b82f6;
    transform: translateX(-2px);
}

.rsd-fp-nav-item.active {
    background: linear-gradient(135deg, #3b82f6 0%, #6366f1 100%);
    color: #fff !important;
    box-shadow: 0 4px 12px rgba(59, 130, 246, .3);
}

.rsd-fp-nav-item .rsd-icon {
    width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.rsd-fp-sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid #f1f5f9;
    margin-top: auto;
}

.rsd-fp-version {
    font-size: 11px;
    color: #94a3b8;
    text-align: center;
}

/* ============================================
   TOP BAR (HEADER)
============================================ */
.rsd-fp-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 22px;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(10px);
    border-radius: 18px;
    border: 1px solid rgba(226, 232, 240, 0.5);
    box-shadow: 0 1px 3px rgba(15, 23, 42, .04);
    margin-bottom: 24px;
}

.rsd-fp-user-menu {
    display: flex;
    align-items: center;
    gap: 14px;
}

.rsd-fp-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: linear-gradient(135deg, #60a5fa, #a78bfa);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 14px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(59, 130, 246, .25);
    flex-shrink: 0;
}

.rsd-fp-user-info .rsd-fp-user-name {
    display: block;
    font-size: 14px;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.3;
}

.rsd-fp-user-info .rsd-fp-user-role {
    font-size: 12px;
    color: #64748b;
}

.rsd-fp-user-dropdown {
    display: inline-block;
    color: #64748b;
    margin: 0 4px;
}

.rsd-fp-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.rsd-fp-search {
    position: relative;
    width: 420px;
    max-width: 50%;
}

.rsd-fp-search input {
    width: 100%;
    padding: 10px 40px 10px 14px;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    font-size: 13px;
    outline: none;
    transition: .2s;
    font-family: inherit;
}

.rsd-fp-search input:focus {
    border-color: #3b82f6;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, .1);
}

.rsd-fp-search .search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    pointer-events: none;
}

.rsd-fp-notif-btn {
    position: relative;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    color: #475569;
    cursor: pointer;
    transition: .2s;
}

.rsd-fp-notif-btn:hover {
    background: #fff;
    border-color: #cbd5e1;
    transform: translateY(-1px);
}


/* ============================================
   CARDS & CONTAINERS
============================================ */
.rsd-grid {
    display: grid;
    gap: 20px;
    margin-bottom: 20px;
}

.rsd-grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.rsd-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.rsd-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

@media (max-width: 1280px) {
    .rsd-grid-4 { grid-template-columns: repeat(2, 1fr); }
    .rsd-grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    .rsd-grid-4, .rsd-grid-3, .rsd-grid-2 { grid-template-columns: 1fr; }
    .rsd-fp-sidebar { position: relative; width: 100%; height: auto; }
    .rsd-fp-wrapper { flex-direction: column-reverse; }
    .rsd-fp-search { display: none; }
}

.rsd-card {
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(226, 232, 240, 0.7);
    border-radius: 18px;
    padding: 22px;
    box-shadow: 0 4px 20px rgba(15, 23, 42, .04);
    transition: box-shadow .2s, transform .2s;
}

.rsd-card:hover {
    box-shadow: 0 8px 30px rgba(15, 23, 42, .08);
}

.rsd-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 14px;
    border-bottom: 1px solid #f1f5f9;
}

.rsd-card-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    font-weight: 700;
    color: #0f172a;
}

.rsd-card-title .rsd-card-icon {
    width: 26px;
    height: 26px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #e0f2fe;
    color: #0369a1;
}

.rsd-card-count-badge {
    display: inline-block;
    padding: 3px 10px;
    background: #fee2e2;
    color: #dc2626;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 700;
}

/* ============================================
   STATS CARDS (WELCOME + TOP NUMBERS)
============================================ */
.rsd-stats-welcome {
    background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
    color: #fff;
    border-radius: 18px;
    padding: 28px;
    position: relative;
    overflow: hidden;
    min-height: 140px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    box-shadow: 0 10px 30px rgba(59, 130, 246, .3);
}

.rsd-stats-welcome::before {
    content: '';
    position: absolute;
    left: -30px;
    top: -30px;
    width: 180px;
    height: 180px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
}

.rsd-stats-welcome::after {
    content: '';
    position: absolute;
    right: -60px;
    bottom: -60px;
    width: 200px;
    height: 200px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 50%;
}

.rsd-stats-welcome h2 {
    color: #fff;
    font-size: 22px;
    font-weight: 800;
    margin-bottom: 6px;
    position: relative;
    z-index: 1;
}

.rsd-stats-welcome p {
    color: rgba(255, 255, 255, .9);
    font-size: 13px;
    margin: 0;
    position: relative;
    z-index: 1;
}

.rsd-stats-welcome .welcome-go {
    position: absolute;
    left: 28px;
    bottom: 28px;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.2);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    z-index: 1;
    cursor: pointer;
    transition: .2s;
}

.rsd-stats-welcome .welcome-go:hover {
    background: rgba(255, 255, 255, 0.3);
}

.rsd-stat-card {
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(226, 232, 240, 0.7);
    border-radius: 18px;
    padding: 22px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    position: relative;
    transition: transform .2s, box-shadow .2s;
    box-shadow: 0 1px 3px rgba(15, 23, 42, .04);
}

.rsd-stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 28px rgba(15, 23, 42, .08);
}

.rsd-stat-card .stat-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 13px;
    color: #64748b;
    font-weight: 500;
}

.rsd-stat-card .stat-icon {
    width: 36px;
    height: 36px;
    border-radius: 11px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.rsd-stat-card.stat-green .stat-icon { background: #dcfce7; color: #16a34a; }
.rsd-stat-card.stat-purple .stat-icon { background: #f3e8ff; color: #9333ea; }
.rsd-stat-card.stat-red .stat-icon { background: #fee2e2; color: #dc2626; }
.rsd-stat-card.stat-blue .stat-icon { background: #dbeafe; color: #2563eb; }

.rsd-stat-card .stat-amount {
    font-size: 20px;
    font-weight: 800;
    color: #0f172a;
    line-height: 1.2;
}

.rsd-stat-card .stat-change {
    font-size: 12px;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-weight: 600;
}

.rsd-stat-card.stat-green .stat-change { color: #16a34a; }
.rsd-stat-card.stat-purple .stat-change { color: #9333ea; }
.rsd-stat-card.stat-red .stat-change { color: #dc2626; }
.rsd-stat-card.stat-blue .stat-change { color: #2563eb; }

/* ============================================
   BADGES
============================================ */
.rsd-badge {
    display: inline-block;
    padding: 3px 10px;
    font-size: 11px;
    font-weight: 700;
    border-radius: 8px;
    line-height: 1.6;
    vertical-align: middle;
}

.rsd-badge-success { background: #dcfce7; color: #16a34a; }
.rsd-badge-danger  { background: #fee2e2; color: #dc2626; }
.rsd-badge-warning { background: #fef3c7; color: #b45309; }
.rsd-badge-info    { background: #dbeafe; color: #2563eb; }
.rsd-badge-primary { background: #ede9fe; color: #7c3aed; }
.rsd-badge-secondary { background: #f1f5f9; color: #475569; }

/* ============================================
   BUTTONS
============================================ */
.rsd-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 16px;
    border-radius: 11px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all .2s;
    font-family: inherit;
    line-height: 1.3;
    text-decoration: none !important;
    white-space: nowrap;
}

.rsd-btn:disabled { opacity: .5; cursor: not-allowed; }
.rsd-btn-sm { padding: 6px 12px; font-size: 12px; border-radius: 9px; }
.rsd-btn-lg { padding: 12px 24px; font-size: 14px; border-radius: 13px; }

.rsd-btn-primary {
    background: linear-gradient(135deg, #3b82f6, #6366f1) !important;
    color: #fff !important;
    border-color: transparent !important;
    box-shadow: 0 4px 12px rgba(59, 130, 246, .3);
}
.rsd-btn-primary:hover { box-shadow: 0 6px 18px rgba(59, 130, 246, .4); transform: translateY(-1px); color: #fff !important; }

.rsd-btn-success { background: #10b981 !important; color: #fff !important; }
.rsd-btn-success:hover { background: #059669 !important; color: #fff !important; }

.rsd-btn-danger { background: #ef4444 !important; color: #fff !important; }
.rsd-btn-danger:hover { background: #dc2626 !important; color: #fff !important; }

.rsd-btn-warning { background: #f59e0b !important; color: #fff !important; }
.rsd-btn-warning:hover { background: #d97706 !important; color: #fff !important; }

.rsd-btn-outline {
    background: #fff !important;
    color: #475569 !important;
    border-color: #e2e8f0 !important;
}
.rsd-btn-outline:hover { background: #f8fafc !important; border-color: #cbd5e1 !important; color: #0f172a !important; }

.rsd-btn-light {
    background: #f1f5f9 !important;
    color: #475569 !important;
    border: none !important;
}
.rsd-btn-light:hover { background: #e2e8f0 !important; color: #0f172a !important; }

/* ============================================
   LISTS (Documents, Messages, etc.)
============================================ */
.rsd-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.rsd-list-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: #f8fafc !important;
    border: 1px solid #f1f5f9 !important;
    border-radius: 12px !important;
    transition: all .2s;
}

.rsd-list-item:hover {
    background: #fff !important;
    border-color: #e2e8f0 !important;
    transform: translateX(-2px) !important;
    box-shadow: 0 4px 12px rgba(15, 23, 42, .04);
}

.rsd-list-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: #eff6ff !important;
    color: #2563eb !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.rsd-list-main { flex: 1; min-width: 0; }
.rsd-list-title {
    font-size: 13px;
    font-weight: 600;
    color: #0f172a !important;
    line-height: 1.4;
    margin-bottom: 3px;
}
.rsd-list-meta {
    font-size: 11px;
    color: #64748b !important;
}

.rsd-list-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

/* ============================================
   MESSAGE CHAT STYLES
============================================ */
.rsd-chat {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 10px 0 20px;
    max-height: 500px;
    overflow-y: auto;
}

.rsd-chat-msg {
    display: flex;
    gap: 10px;
    max-width: 85%;
}

.rsd-chat-msg.mine { margin-left: auto; flex-direction: row-reverse; }

.rsd-chat-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 12px;
}

.rsd-chat-msg.theirs .rsd-chat-avatar { background: #6366f1; }
.rsd-chat-msg.mine .rsd-chat-avatar { background: #10b981; }

.rsd-chat-bubble {
    padding: 12px 14px;
    border-radius: 14px;
    font-size: 13px;
    line-height: 1.7;
    position: relative;
}

.rsd-chat-msg.theirs .rsd-chat-bubble {
    background: #f1f5f9;
    color: #0f172a;
    border-top-right-radius: 4px;
}

.rsd-chat-msg.mine .rsd-chat-bubble {
    background: linear-gradient(135deg, #3b82f6, #6366f1);
    color: #fff;
    border-top-left-radius: 4px;
}

.rsd-chat-time {
    display: block;
    margin-top: 6px;
    font-size: 10px;
    opacity: .75;
}

.rsd-chat-attachments {
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.rsd-chat-attachment {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: rgba(255, 255, 255, .2);
    border-radius: 8px;
    font-size: 12px;
}

/* ============================================
   TABLES
============================================ */
.rsd-table-wrap {
    overflow-x: auto;
    border-radius: 12px;
    border: 1px solid #f1f5f9;
}

.rsd-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
}

.rsd-table thead th {
    background: #f8fafc;
    padding: 12px 14px;
    font-size: 12px;
    font-weight: 700;
    color: #64748b;
    text-align: right;
    border-bottom: 1px solid #e2e8f0;
    white-space: nowrap;
}

.rsd-table tbody td {
    padding: 14px;
    font-size: 13px;
    color: #334155;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
}

.rsd-table tbody tr:hover td { background: #fafbfc; }
.rsd-table tbody tr:last-child td { border-bottom: none; }

.rsd-table .cell-amount {
    font-weight: 700;
    color: #0f172a;
    font-size: 14px;
    white-space: nowrap;
}

.rsd-table .cell-actions {
    display: flex;
    gap: 6px;
}

/* ============================================
   FORMS
============================================ */
.rsd-form-row { margin-bottom: 16px; }

.rsd-form-row label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #475569;
    margin-bottom: 6px;
}

.rsd-form-row label .required { color: #ef4444; margin-left: 3px; }

.rsd-form-row input[type="text"],
.rsd-form-row input[type="email"],
.rsd-form-row input[type="url"],
.rsd-form-row input[type="number"],
.rsd-form-row input[type="date"],
.rsd-form-row input[type="time"],
.rsd-form-row input[type="password"],
.rsd-form-row textarea,
.rsd-form-row select {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #e2e8f0;
    border-radius: 11px;
    background: #fff;
    font-size: 13px;
    color: #0f172a;
    outline: none;
    transition: all .2s;
    font-family: inherit;
    line-height: 1.5;
}

.rsd-form-row textarea { min-height: 100px; resize: vertical; }

.rsd-form-row input:focus,
.rsd-form-row textarea:focus,
.rsd-form-row select:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, .1);
}

.rsd-form-row-inline {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.rsd-form-hint { font-size: 11px; color: #94a3b8; margin-top: 5px; }

.rsd-form-error {
    font-size: 11px;
    color: #ef4444;
    margin-top: 5px;
}

/* ============================================
   TABS
============================================ */
.rsd-tabs {
    display: flex;
    gap: 4px;
    padding: 4px;
    background: #f1f5f9;
    border-radius: 12px;
    margin-bottom: 18px;
    overflow-x: auto;
}

.rsd-tab {
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    color: #64748b;
    border-radius: 9px;
    cursor: pointer;
    transition: all .2s;
    white-space: nowrap;
    flex: 0 0 auto;
    text-decoration: none !important;
}

.rsd-tab:hover { color: #0f172a; }
.rsd-tab.active {
    background: #fff;
    color: #3b82f6;
    box-shadow: 0 2px 6px rgba(15, 23, 42, .06);
}

/* ============================================
   CALENDAR MONTH GRID
============================================ */
.rsd-calendar {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.rsd-calendar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px;
    background: #f8fafc;
    border-radius: 12px;
    border: 1px solid #f1f5f9;
}

.rsd-cal-nav-btn {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    background: #fff;
    border: 1px solid #e2e8f0;
    color: #475569;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: .2s;
}
.rsd-cal-nav-btn:hover { background: #f1f5f9; }

.rsd-cal-title { font-size: 15px; font-weight: 700; color: #0f172a; }

.rsd-cal-view-switcher {
    display: inline-flex;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 9px;
    padding: 3px;
    gap: 2px;
}

.rsd-cal-view-btn {
    padding: 5px 11px;
    font-size: 11px;
    font-weight: 600;
    color: #64748b;
    border-radius: 7px;
    cursor: pointer;
    transition: .2s;
}
.rsd-cal-view-btn.active { background: #3b82f6; color: #fff; }

.rsd-cal-grid {
    background: #fff;
    border: 1px solid #f1f5f9;
    border-radius: 14px;
    overflow: hidden;
}

.rsd-cal-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}

.rsd-cal-weekdays div {
    padding: 10px;
    text-align: center;
    font-size: 11px;
    font-weight: 700;
    color: #64748b;
}

.rsd-cal-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
}

.rsd-cal-day {
    min-height: 90px;
    padding: 6px;
    border: 1px solid #f1f5f9;
    position: relative;
    cursor: pointer;
    transition: background .15s;
    font-size: 11px;
}

.rsd-cal-day:hover { background: #fafbfc; }
.rsd-cal-day.other-month { opacity: .35; }

.rsd-cal-day.today {
    background: linear-gradient(135deg, rgba(59,130,246,.08), rgba(99,102,241,.08));
}

.rsd-cal-day.today .rsd-cal-num {
    background: #3b82f6;
    color: #fff;
    box-shadow: 0 2px 6px rgba(59,130,246,.35);
}

.rsd-cal-num {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    color: #475569;
}

.rsd-cal-event {
    margin-top: 4px;
    padding: 3px 6px;
    border-radius: 5px;
    font-size: 10px;
    font-weight: 600;
    color: #fff;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    border-right: 3px solid rgba(0,0,0,.2);
}

/* ============================================
   ALERTS
============================================ */
.rsd-alert {
    padding: 12px 16px;
    border-radius: 11px;
    font-size: 13px;
    margin-bottom: 16px;
    line-height: 1.6;
    border: 1px solid transparent;
}

.rsd-alert-success { background: #dcfce7; color: #166534; border-color: #bbf7d0; }
.rsd-alert-danger  { background: #fee2e2; color: #991b1b; border-color: #fecaca; }
.rsd-alert-warning { background: #fef3c7; color: #92400e; border-color: #fde68a; }
.rsd-alert-info    { background: #dbeafe; color: #1e40af; border-color: #bfdbfe; }

/* ============================================
   DONUT CHART (SVG)
============================================ */
.rsd-donut-wrap {
    text-align: center;
    padding: 14px;
}

.rsd-donut {
    position: relative;
    display: inline-block;
    width: 120px;
    height: 120px;
}

.rsd-donut svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.rsd-donut svg circle { fill: none; stroke-width: 10; }
.rsd-donut .donut-bg { stroke: #f1f5f9; }
.rsd-donut .donut-fg { stroke-linecap: round; transition: stroke-dashoffset .6s; }

.rsd-donut-center {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.rsd-donut-amount { font-size: 18px; font-weight: 800; color: #0f172a; }
.rsd-donut-label { font-size: 10px; color: #64748b; }

.rsd-legend {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 16px;
    padding: 0 4px;
}

.rsd-legend-item {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 11px;
    color: #475569;
}

.rsd-legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

/* ============================================
   FILTERS TOOLBAR
============================================ */
.rsd-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    background: #fff;
    border: 1px solid #f1f5f9;
    border-radius: 14px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}

.rsd-toolbar .rsd-filter {
    padding: 8px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #f8fafc;
    font-size: 12px;
    color: #475569;
    outline: none;
    font-family: inherit;
    cursor: pointer;
}

.rsd-toolbar .spacer { flex: 1; }

/* ============================================
   MODAL / DIALOG
============================================ */
.rsd-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .55);
    backdrop-filter: blur(2px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 20px;
}

.rsd-modal-backdrop.show { display: flex; }

.rsd-modal {
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 25px 80px rgba(0,0,0,.3);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.rsd-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 22px;
    border-bottom: 1px solid #f1f5f9;
}

.rsd-modal-title {
    font-size: 16px;
    font-weight: 700;
    color: #0f172a;
}

.rsd-modal-close {
    width: 32px !important;
    height: 32px !important;
    border-radius: 9px !important;
    border: none !important;
    background: #f1f5f9 !important;
    color: #64748b !important;
    cursor: pointer !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: .2s !important;
}

.rsd-modal-close:hover { background: #e2e8f0 !important; color: #0f172a !important; }

.rsd-modal-body {
    padding: 22px !important;
    overflow-y: auto !important;
    flex: 1 !important;
}

.rsd-modal-footer {
    display: flex !important;
    justify-content: flex-end !important;
    gap: 10px !important;
    padding: 16px 22px !important;
    border-top: 1px solid #f1f5f9 !important;
    background: #f8fafc !important;
}

/* ============================================
   UPLOAD AREA
============================================ */
.rsd-upload-area {
    border: 2px dashed #cbd5e1 !important;
    border-radius: 14px !important;
    padding: 30px 20px !important;
    text-align: center !important;
    background: #fafbfc !important;
    color: #64748b !important;
    cursor: pointer !important;
    transition: all .2s !important;
}

.rsd-upload-area.dragover,
.rsd-upload-area:hover {
    border-color: #3b82f6 !important;
    background: #eff6ff !important;
    color: #3b82f6 !important;
}

.rsd-upload-area .upload-icon {
    width: 48px !important;
    height: 48px !important;
    border-radius: 12px !important;
    background: #dbeafe !important;
    color: #2563eb !important;
    margin: 0 auto 12px !important;
    display: flex;
    align-items: center;
    justify-content: center;
}

.rsd-upload-area .upload-text {
    font-size: 13px !important;
    font-weight: 600 !important;
    margin-bottom: 4px !important;
}

.rsd-upload-area .upload-hint { font-size: 11px !important; opacity: .8 !important; }

/* ============================================
   SERVICES GRID
============================================ */
.rsd-services-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px !important;
}

.rsd-service-card {
    background: #fff !important;
    border: 1px solid #f1f5f9 !important;
    border-radius: 16px !important;
    padding: 20px !important;
    transition: all .2s !important;
    cursor: pointer !important;
    display: flex;
    flex-direction: column;
    gap: 10px !important;
}

.rsd-service-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(15, 23, 42, .1);
    border-color: #e0e7ff !important;
}

.rsd-service-icon {
    width: 46px !important;
    height: 46px !important;
    border-radius: 12px !important;
    background: linear-gradient(135deg, #dbeafe, #ede9fe) !important;
    color: #4f46e5 !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.rsd-service-card h3 {
    font-size: 15px !important;
    font-weight: 700;
    color: #0f172a;
}

.rsd-service-card p {
    font-size: 12px !important;
    color: #64748b !important;
    margin: 0;
    flex: 1;
}

.rsd-service-card .svc-go {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: #3b82f6 !important;
    font-size: 12px !important;
    font-weight: 600 !important;
}

/* ============================================
   FOOTER
============================================ */
.rsd-fp-footer {
    margin-top: 30px !important;
    padding: 18px 22px !important;
    background: rgba(255, 255, 255, .7);
    backdrop-filter: blur(6px);
    border: 1px solid rgba(226, 232, 240, .5);
    border-radius: 16px !important;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.rsd-fp-footer-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    flex: 1;
    justify-content: space-around;
}

.rsd-fp-footer-action {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 14px;
    border-radius: 10px;
    background: #fff;
    border: 1px solid #f1f5f9;
    color: #475569;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all .2s;
    text-decoration: none !important;
}

.rsd-fp-footer-action:hover {
    background: #f8fafc;
    border-color: #e2e8f0;
    color: #0f172a;
    transform: translateY(-1px);
}

.rsd-fp-footer-info {
    font-size: 11px;
    color: #94a3b8;
    display: flex;
    align-items: center;
    gap: 8px;
}

.rsd-fp-footer-info .heart {
    color: #ef4444;
    display: inline-block;
    animation: heartbeat 1.6s ease-in-out infinite;
}

@keyframes heartbeat {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}

/* ============================================
   ICONS (inline SVG placeholders & fallback)
============================================ */
.rsd-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
}

.rsd-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid #cbd5e1;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin .7s linear infinite;
    display: inline-block;
    vertical-align: middle;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Toast notifications */
.rsd-toasts {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.rsd-toast {
    pointer-events: auto;
    padding: 12px 16px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(15, 23, 42, .18);
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 260px;
    max-width: 420px;
    border-right: 4px solid #3b82f6;
    animation: toastIn .3s ease;
    font-size: 13px;
}

.rsd-toast.success { border-right-color: #10b981; }
.rsd-toast.error { border-right-color: #ef4444; }
.rsd-toast.warning { border-right-color: #f59e0b; }

@keyframes toastIn {
    from { opacity: 0; transform: translateX(-20px); }
    to { opacity: 1; transform: translateX(0); }
}

.rsd-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 16px 0;
}

.rsd-pagination .page-btn {
    min-width: 34px;
    height: 34px;
    padding: 0 10px;
    border-radius: 9px;
    background: #fff;
    border: 1px solid #e2e8f0;
    color: #475569;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: .2s;
}

.rsd-pagination .page-btn.active {
    background: #3b82f6;
    border-color: #3b82f6;
    color: #fff;
}

.rsd-pagination .page-btn:hover:not(.active) { background: #f1f5f9; }

/* Fix for WordPress theme padding if any */
.rsd-fp-portal .site-main,
.rsd-fp-portal .content-area {
    padding: 0 !important;
    margin: 0 !important;
    max-width: 100% !important;
}

.rsd-fp-portal .entry-header,
.rsd-fp-portal .entry-footer { display: none !important; }

.rsd-fp-portal .entry-content {
    padding: 0;
    margin: 0;
}

/* ========== Notification Dropdown (Client Portal Header) ========== */
.rsd-fp-header {
    position: relative;
    z-index: 9500;
}
.rsd-fp-notif-wrapper {
    position: relative;
    display: inline-block;
    z-index: 9600;
}

.rsd-fp-notif-btn.rsd-notif-bell {
    position: relative;
    z-index: 9700;
    border: 0;
    background: rgba(255, 255, 255, 0.82);
    width: 48px; height: 40px;
    border-radius: 12px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
    cursor: pointer;
    font-size: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.18s ease;
}
.rsd-fp-notif-btn.rsd-notif-bell:hover { background: #ffffff; transform: translateY(-1px); }
.rsd-fp-notif-btn.rsd-notif-bell.open {
    background: #eef2ff;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.18);
}

.rsd-fp-badge {
    position: absolute;
    top: -3px;
    inset-inline-start: -3px;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 999px;
    background: #ef4444;
    color: #ffffff !important;
    font-size: 11px;
    font-weight: 800;
    font-family: monospace;
    line-height: 20px;
    text-align: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 3px rgba(239, 68, 68, 0.3);
}

.rsd-notif-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    inset-inline-end: 0;
    width: 400px;
    max-width: calc(100vw - 28px);
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 12px 36px rgba(15, 23, 42, 0.12), 0 0 0 1px rgba(226, 232, 240, 0.9);
    border: 1px solid rgba(226, 232, 240, 0.9);
    overflow: hidden;
    z-index: 99999 !important;
    animation: rsdNotifIn 0.18s ease-out;
    direction: rtl;
    text-align: right;
    isolation: isolate;
}
@keyframes rsdNotifIn {
    from { opacity: 0; transform: translateY(-6px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.rsd-notif-dropdown-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid rgba(226, 232, 240, 0.9);
    background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
    font-size: 13px;
}
.rsd-notif-mark-all {
    border: 0 !important;
    background: rgba(59, 130, 246, 0.08) !important;
    color: #2563eb !important;
    padding: 6px 12px !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    border-radius: 999px !important;
    cursor: pointer !important;
    transition: background 0.15s ease !important;
}
.rsd-notif-mark-all:hover { background: rgba(59, 130, 246, 0.16) !important; }
.rsd-notif-mark-all:disabled { opacity: 0.55 !important; cursor: not-allowed !important; }

.rsd-notif-list {
    max-height: 420px;
    overflow-y: auto;
    background: #ffffff;
}
.rsd-notif-list::-webkit-scrollbar { width: 9px; }
.rsd-notif-list::-webkit-scrollbar-thumb { background: #cbd5e1 !important; border-radius: 999px !important; }
.rsd-notif-list::-webkit-scrollbar-thumb:hover { background: #94a3b8 !important; }

.rsd-notif-item {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 14px 16px;
    border-bottom: 1px solid rgba(241, 245, 249, 0.95);
    text-decoration: none;
    color: inherit;
    position: relative;
    transition: background 0.15s ease;
    cursor: pointer;
}
.rsd-notif-item:last-child { border-bottom: 0; }
.rsd-notif-item:hover { background: #f8fafc; }

.rsd-notif-item.unread::before {
    content: "";
    position: absolute;
    inset-inline-start: 10px;
    top: 20px;
    width: 9px;
    height: 9px;
    background: #6366f1;
    border-radius: 50%;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.18);
}

.rsd-notif-icon {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: linear-gradient(135deg, #e0e7ff 0%, #ede9fe 100%);
    color: #4f46e5;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    margin-inline-end: 4px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.rsd-notif-body {
    flex: 1 1 auto;
    min-width: 0;
    padding-inline-start: 8px;
}

.rsd-notif-title {
    font-size: 13px;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.5;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}
.rsd-notif-title .rsd-notif-time {
    font-size: 10px;
    font-weight: 500;
    color: #94a3b8;
    white-space: nowrap;
    flex-shrink: 0;
}
.rsd-notif-msg {
    margin-top: 3px;
    font-size: 12px;
    line-height: 1.55;
    color: #475569;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.rsd-notif-dismiss {
    flex-shrink: 0 !important;
    width: 24px !important; height: 24px !important;
    border-radius: 8px !important;
    border: 0 !important;
    background: transparent !important;
    color: #94a3b8 !important;
    font-size: 14px !important;
    font-weight: 700 !important;
    line-height: 24px !important;
    text-align: center;
    cursor: pointer;
    transition: all 0.15s ease;
}
.rsd-notif-dismiss:hover {
    background: #fee2e2;
    color: #dc2626;
    transform: scale(1.08);
}

.rsd-notif-empty {
    padding: 44px 20px;
    text-align: center;
    color: #64748b;
}
.rsd-notif-empty-icon {
    width: 56px !important; height: 56px !important;
    border-radius: 50% !important;
    background: linear-gradient(135deg, #dcfce7 0%, #d1fae5 100%);
    color: #059669 !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 28px !important;
    margin-bottom: 14px !important;
}
.rsd-notif-empty h4 {
    margin: 0 0 6px 0;
    font-size: 14px !important;
    color: #0f172a !important;
}
.rsd-notif-empty p {
    margin: 0 !important;
    font-size: 12px !important;
}

.rsd-notif-dropdown-foot {
    padding: 12px 18px;
    border-top: 1px solid rgba(226, 232, 240, 0.9);
    background: #f8fafc;
    text-align: center;
}

@media (max-width: 520px) {
    .rsd-notif-dropdown { width: calc(100vw - 28px); right: -8px; }
}
