/* --- RESET & LAYOUT --- */
#saas-dashboard-wrapper {
    display: flex;
    min-height: 100vh;
    font-family: 'Inter', 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background-color: #f1f5f9;
    color: #334155;
    margin: 0;
    width: 100%;
}

* { box-sizing: border-box; }

/* --- SIDEBAR --- */
.saas-sidebar {
    width: 260px;
    background-color: #0f172a; /* Slate 900 */
    color: #fff;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    transition: width 0.3s;
}

.saas-brand {
    padding: 25px 20px;
    background-color: #020617;
    border-bottom: 1px solid #1e293b;
}

.saas-brand h2 {
    margin: 0;
    color: #fff;
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.saas-nav ul { list-style: none; padding: 0; margin: 0; }

.saas-nav li a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 25px;
    color: #94a3b8;
    text-decoration: none;
    font-size: 0.95rem;
    transition: 0.2s;
    border-left: 3px solid transparent;
}

.saas-nav li a i { width: 20px; text-align: center; }

.saas-nav li a:hover,
.saas-nav li.active a {
    background-color: #1e293b;
    color: #f8fafc;
    border-left-color: #3b82f6; /* Primary Blue */
}

.saas-nav li.logout { margin-top: auto; border-top: 1px solid #1e293b; }
.saas-nav li.logout a { color: #f87171; }
.saas-nav li.logout a:hover { background: #450a0a; color: #fca5a5; }

/* --- MAIN CONTENT --- */
.saas-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

.saas-topbar {
    background: #fff;
    height: 70px;
    padding: 0 40px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: flex-end;
    align-items: center;
}

.user-info { display: flex; align-items: center; gap: 15px; font-weight: 500; }
.user-info .avatar img { border-radius: 50%; border: 2px solid #e2e8f0; }

.saas-module-container { padding: 40px; max-width: 1400px; margin: 0 auto; width: 100%; }

/* --- MODULE HEADER --- */
.saas-module-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.saas-module-header h2 {
    font-size: 1.8rem;
    color: #0f172a;
    font-weight: 700;
    margin: 0;
}

/* --- BUTTONS --- */
.button-primary {
    background: #2563eb;
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: background 0.2s;
}
.button-primary:hover { background: #1d4ed8; }

.action-btn {
    text-decoration: none;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 500;
    margin-right: 5px;
    border: 1px solid transparent;
}
.action-btn.edit { background: #eff6ff; color: #2563eb; }
.action-btn.edit:hover { background: #dbeafe; }
.action-btn.view { background: #f0fdf4; color: #16a34a; }
.action-btn.delete { background: #fef2f2; color: #dc2626; }
.action-btn.delete:hover { background: #fee2e2; }

/* --- CARDS & GRID --- */
.saas-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
    margin-bottom: 40px;
}

.saas-card {
    background: #fff;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.02);
    border: 1px solid #f1f5f9;
}

.saas-card h3 {
    margin-top: 0;
    font-size: 0.85rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

.saas-card .value {
    font-size: 2.25rem;
    font-weight: 700;
    color: #0f172a;
    margin-top: 5px;
}

/* --- TABLES --- */
.saas-table-wrapper {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    border: 1px solid #e2e8f0;
}

.saas-table {
    width: 100%;
    border-collapse: collapse;
}

.saas-table th {
    background-color: #f8fafc;
    color: #475569;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    padding: 16px 24px;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
}

.saas-table td {
    padding: 16px 24px;
    border-bottom: 1px solid #f1f5f9;
    color: #334155;
    vertical-align: middle;
}

.saas-table tr:last-child td { border-bottom: none; }

/* --- BADGES --- */
.status-badge {
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}
.status-badge.completed, .status-badge.approved, .status-badge.publish { background: #dcfce7; color: #166534; }
.status-badge.pending, .status-badge.processing, .status-badge.on-hold { background: #fef9c3; color: #854d0e; }
.status-badge.failed, .status-badge.cancelled, .status-badge.rejected { background: #fee2e2; color: #991b1b; }

/* --- FORMS & MODALS --- */
.saas-modal {
    position: fixed;
    z-index: 1000;
    left: 0; top: 0;
    width: 100%; height: 100%;
    background-color: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: 0.2s;
}

.saas-modal.active {
    opacity: 1;
    visibility: visible;
}

.saas-modal-content {
    background-color: #fff;
    width: 100%;
    max-width: 550px;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    position: relative;
    transform: translateY(20px);
    transition: 0.3s;
}

.saas-modal.active .saas-modal-content { transform: translateY(0); }

.saas-modal-content h3 { margin-top: 0; font-size: 1.5rem; color: #0f172a; }

.close {
    position: absolute;
    right: 20px;
    top: 20px;
    font-size: 24px;
    color: #94a3b8;
    cursor: pointer;
    line-height: 1;
}
.close:hover { color: #475569; }

.form-group { margin-bottom: 20px; }
.form-group label { display: block; margin-bottom: 8px; font-weight: 500; color: #334155; }
.widefat {
    width: 100%;
    padding: 12px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.2s;
    background: #fff;
}
.widefat:focus { outline: none; border-color: #3b82f6; box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1); }

/* --- ALERTS --- */
.saas-alert {
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 25px;
    font-weight: 500;
}
.saas-alert.success { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }
.saas-alert.error { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }